Use a foreach loop through an int array : int array « Data Type « C# / CSharp Tutorial






class MainClass
{

  public static void Main()
  {

    int [] myValues = {2, 4, 3, 5, 1};
    foreach (int counter in myValues)
    {
      System.Console.WriteLine("counter = " + counter);
    }

  }

}
counter = 2
counter = 4
counter = 3
counter = 5
counter = 1








2.5.int array
2.5.1.int arrays
2.5.2.Initialize int arrays
2.5.3.Use a foreach loop through an int array
2.5.4.int array with for loop
2.5.5.Get the Max Value in an array