Enumerator Basics C# with Example



Enumerator Basics C# with Example

 using System;
using System.Collections;

namespace CSharpCollection
{
    class EnumeratorBasics
    {
		static void Main()
		{
			int[] MyArray = { 10, 11, 12, 13 }; // Create an array.
			IEnumerator ie = MyArray.GetEnumerator();

			while ( ie.MoveNext() )
			{
				int i = (int) ie.Current;
				Console.WriteLine("{0}", i); // Write it out.
			}
		}
    }
}
 

0 Comment's

Comment Form

Submit Comment