Answers for "for(item in array) c#"

C#
12

c# loop through array

//iterate the array
for (int i = 0; i < arr.Length; i++)
{
  // loop ...
}
// or
foreach (var element in arr)
{
  // loop ...
}
Posted by: Guest on May-16-2020
2

c# loop string array

//Using Linq to itterate over an array
var strArr = new string[4] {"one", "Two", "Three", "Four"};
Console.WriteLine(strArr.Select((s, i) => $"Item no: {i + 1}, Value: {s}"));
Posted by: Guest on April-17-2020

C# Answers by Framework

Browse Popular Code Answers by Language