Answers for "how to loop through two arrays in c# and compare"

C#
3

loop through multidimensional array c#

for (int x = 0; x < YourArray.GetLength(0); x++)
{
    for (int y = 0; y < YourArray.GetLength(1); y++)
    {
        Console.WriteLine(YourArray[x, y]);
    }
}
Posted by: Guest on February-10-2021
0

foreach two arrays c#

var numbers = new [] { 1, 2, 3, 4 };
var words = new [] { "one", "two", "three", "four" };

var numbersAndWords = numbers.Zip(words, (n, w) => new { Number = n, Word = w });
foreach(var nw in numbersAndWords)
{
    Console.WriteLine(nw.Number + nw.Word);
}
Posted by: Guest on December-09-2020

Code answers related to "how to loop through two arrays in c# and compare"

C# Answers by Framework

Browse Popular Code Answers by Language