> For the complete documentation index, see [llms.txt](https://andreyakinshin.gitbook.io/problembookdotnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andreyakinshin.gitbook.io/problembookdotnet/en/linq/tryyieldfinally-p.md).

# “TryYieldFinally” (Problem)

What will the following code display?

```csharp
public static IEnumerable<int> GetSmallNumbers()
{
  try
  {
    yield return 1;
    yield return 2;
  }
  finally
  {
    Console.WriteLine("Foo");
  }
}
void Main()
{
  Console.WriteLine(GetSmallNumbers().First());
}
```

[Solution](/problembookdotnet/en/linq/tryyieldfinally-s.md)
