I am working with 2D arrays. what I want, is to dynamically add elements in specific columns of my 2D array named symboltable2.
I have been doing it as;
result is another 1D array in which there are certain words:
string[,] symboltable2 = new string[,];
if (result.Contains("int")) {
for (int todynamic = 0; todynamic < result.GetLength(0); todynamic++) {
symboltable2[todynamic, 6] = "int";
}
for (int sym2 = 0; i < symboltable1.GetLength(0); sym2++) {
f4.listBox6.Items.Add(symboltable1[sym2, 5]); // To show if the values are added or not
}
}
but the code above isn't giving me any results... kindly help :(
while implementing arrays you need to give the array's dimension i.e.
string[,] sa = new string[5,15];
or
string[,] sa = new string[listString1.Count, listString2.Count]
about adding / changing elements to 2D array.. as a simple string array example :
sa[0, 1] = "a";
sa[0, 2] = "b";
sa[1, 0] = "Istanbul / Turkey";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With