yield
(print GetString: Foo
), next the loop body will be evaluated for the first enumerable element (print EnumerableToArray: Foo
). Next, the foreach
loop will require the second enumerable element, the second yield
will be evaluated (print GetString: Bar
), the loop body will be evaluated for the second element (print EnumerableToArray: Bar
).GetString: Foo
and GetString: Bar
will be printed again.