Answers for "c# foreach loop for array"

C#
1

c# foreach arra

int[,] numbers2D = new int[3, 2] { { 9, 99 }, { 3, 33 }, { 5, 55 } };
// Or use the short form:
// int[,] numbers2D = { { 9, 99 }, { 3, 33 }, { 5, 55 } };

foreach (int i in numbers2D)
{
    System.Console.Write("{0} ", i);
}
// Output: 9 99 3 33 5 55
Posted by: Guest on May-18-2020
0

syntax foreach loop C#

foreach (type variableName in arrayName) 
{
  // code block to be executed
}
Posted by: Guest on May-01-2021

C# Answers by Framework

Browse Popular Code Answers by Language