c# loop through two dimensional array
using System;
using System.Collections.Generic;
using System.Linq;
public class Demo {
public static void Main() {
string[,] array = new string[3, 3];
array[0, 0] = "One";
array[0, 1] = "Two";
array[0, 2] = "Three";
array[1, 0] = "Four";
array[1, 1] = "Five";
array[1, 2] = "Six";
array[2, 0] = "Seven";
array[2, 1] = "Eight";
array[2, 2] = "Nine";
// getting upper bound
int uBound0 = array.GetUpperBound(0);
int uBound1 = array.GetUpperBound(1);
for (int i = 0; i <= uBound0; i++) {
for (int j = 0; j <= uBound1; j++) {
string res = array[i, j];
Console.WriteLine(res);
}
}
Console.ReadLine();
}
}
Also in C#:
- how to say or in c#
- unity set position
- c# update control from another thread
- how to get joypad axis input unity
- what does gameobject.find return
- c# replace string case insensitive
- c# get motherboard id
- asp.net render control to string
- razor: show editable list
- c# inheritance constructor
- c# iorderedenumerable to dictionary
- convert string to datetime c#
- c# unity max
- c# anonymous class
- c# string to float
- get setter c# model
- asp.net tag helper checkbox
- message uwp c#
- disable button in android studio
- c# convert to nullable datetime
- unity normalize vector2
- c# int
- c# nullable generic
- how to reference scripts in other scenes unity