using System; using System.Collections.Generic; class Prg { static IEnumerable<string> words() { yield return "foo"; yield return "bar"; yield return "baz"; } static void Main() { foreach (string word in words()) { Console.WriteLine(word); } } }
System.Collections.IEnumerable
System.Collections.IEnumerator
System.Collections.Generic.IEnumerable<T>
System.Collections.Generic.IEnumerator<T>
foreach … in
Index