示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }