Maha

Maha

  • NA
  • 0
  • 170.4k

NP97 GetEnumerator()

Apr 23 2008 10:43 AM

Hi Guys

 

NP97 GetEnumerator()

 

http://www.java2s.com/Tutorial/CSharp/0220__Data-Structure/Getitsenumeratorforanarray.htm

 

Following program is in the above website. I wish to know the function of

IEnumerator ie = intArray.GetEnumerator();.In other words what it does.

 

Please explain.

 

Thank you

 

 

using System;

using System.Collections;

 

class MainClass

{

   static void Main()

   {

      int[] intArray = { 10, 11, 12, 13 };

 

      IEnumerator ie = intArray.GetEnumerator();

 

      while (ie.MoveNext() == true)

      {

         int i = (int)ie.Current;

         Console.WriteLine("{0}", i);

      }

   }

}

/*

10

11

12

13

*/


Answers (2)