Using the foreach statement to loop through int array - CSharp Language Basics

CSharp examples for Language Basics:for each

Description

Using the foreach statement to loop through int array

Demo Code

using System;//from  w  w w.j  a va 2  s .c o m
public class ArrayListing {
   public static void Main( ) {
      int[] whole_numbers = {1,2,3,4,5,6,7,8,9,10};

      foreach( int value in whole_numbers )
         Console.WriteLine( "value = {0}", value );
      }
}

Result


Related Tutorials