“LifeAfterYield” (Problem)

What will the following code display?

IEnumerable<string> Foo()
{
  yield return "Bar";
  Console.WriteLine("Baz");
}
void Main()
{
  foreach (var str in Foo())
    Console.Write(str);
}

Solution

Last updated