public static void yield_Statement() { CozyCollection collect = new CozyCollection(); // 使用迭代 foreach(var elemt in collect) { Console.WriteLine(elemt); } foreach (var elemt in collect.Reverse()) { Console.WriteLine(elemt); } foreach (var elemt in collect.Subset(2,4)) { Console.WriteLine(elemt); } }
public static void yield_Statement() { CozyCollection collect = new CozyCollection(); // 使用迭代 foreach (var elemt in collect) { Console.WriteLine(elemt); } foreach (var elemt in collect.Reverse()) { Console.WriteLine(elemt); } foreach (var elemt in collect.Subset(2, 4)) { Console.WriteLine(elemt); } }