Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#yield return generatorsSingle-choice MCQ

What is the output order when this infinite-style generator is consumed with Take?

IEnumerable<int> Counter() { int i = 0; while (true) { Console.Write($"y{i} "); yield return i++; } } foreach (var x in Counter().Take(3)) { Console.Write($"c{x} "); }