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

What is the result of enumerating Outer() below, which delegates to Inner() in a loop?

IEnumerable<int> Inner() { yield return 1; yield return 2; yield return 3; } IEnumerable<int> Outer() { for (int i = 0; i < 2; i++) foreach (var x in Inner()) yield return x; }