By Team Escalera
on 31 Oct 2017 02:55 PM
  • Arrays

Here lets create an array of Fruits (of same data type string)

Name of Our Array is mystrArray and it has 5 elements.


string[] mystrArray = new string[] { “Apple”, “Banana”, “Grapes”, “Mango”, “Pine-Apple” };
// Reading array items using foreach loop
foreach (string mystr in mystrArray)

A loop will iterate through all the elements in the string and Print them one by one as we are referring to Each element of the array.
Foreach loop is very handy when the requirement is to fetch multiple rows of records from a database.

Comments (0)

Leave A Comment