Exemplo n.º 1
0
        private static void EnumeratorTest()
        {
            EnumeratorThing e = new EnumeratorThing(100);

            foreach (int i in e)
            {
                System.Console.WriteLine(i);
            }
        }
        public static void RunObjectEnumerable()
        {
            EnumeratorThing e = new EnumeratorThing(10);

            foreach (int item in e)
            {
                Console.WriteLine(item);
            }
        }
Exemplo n.º 3
0
        private static void CreatingAnEnumerableTypeExample()
        {
            /* You can use an EnumeratorThing instance in a foreach loop */
            EnumeratorThing e = new EnumeratorThing(10);

            foreach (int i in e)
            {
                Console.WriteLine(i);
            }
        }
Exemplo n.º 4
0
        public void UsingEnumerable()
        {
            // You	can	use	an	EnumeratorThing	instance	in	a	foreach	loop:
            EnumeratorThing e = new EnumeratorThing(10);

            foreach (int i in e)
            {
                Console.WriteLine(i);
            }
        }
        public static void RunYield()
        {
            EnumeratorThing e = new EnumeratorThing(10);

            foreach (int i in e)
            {
                Console.WriteLine(i);
            }

            Console.ReadKey();
        }