Get its enumerator for an array : Array IEnumerator : Data Structure C# Examples


C# Examples » Data Structure » Array IEnumerator »

 

Get its enumerator for an array


  1.       
  2. using  System;  
  3. using  System.Collections;  
  4.   
  5. class  MainClass  
  6. {  
  7.       static  void  Main()  
  8.       {  
  9.             int[]  intArray  =  {  10,  11,  12,  13  };                    
  10.   
  11.             IEnumerator  ie  =  intArray.GetEnumerator();        
  12.             while  (ie.MoveNext()  ==  true)                                
  13.             {  
  14.                   int  i  =  (int)ie.Current;                                    
  15.                   Console.WriteLine("{0}",  i);                            
  16.             }  
  17.       }  
  18. }  
  19.       
  20.      
  21.     
  22.      

Output

10
11
12
13


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Array IEnumerator