Hello there, my question is simple as that. I need to declare an array of arrays which are all strings, because I need to creare some sort of "grid". I'm importing a text file with a variable number of rows, but each row will have 4 values separated by ||, (so my idea would be to use a text split to eliminate the NewLines and then another split to eliminate the ||). When imported, the idea would be to set each value of each row into a specific position of the array[ ][ ] so then I can be able to sort each row of the grid based on two possible columns (the columns are 4).
I found online if I use Linq I can use something like "OrderBy(entry => entry[0]).ToArray( )" to sort the grid supposedly based on the first column, but my problem actually is to create a string[ ][ ] which is empty and then I can populate with variable content (remember, I don't know how many rows I have, I also tried but failed to set a basic static size of 100 rows). Visual Studio doesn't exactly prompt errors in the code but instead on the execution. Meaning, I tried different things, first of all array.Append(string1, string2, string3, string4), which would be the 4 values of a row, assuming Append just inserts a string[ ] inside the string[ ][ ] (which should be empty), but when I test it with a MessageBox, recalling the value in array[0][1] it just doesn't work, saying I'm off the limits of the array.
Do you have any suggestions about this? I'm sure I'm going around the same error and I'm missing something basic, but searching online I couln't find anything about this specific case because I find only how to create string[ , ] (jagged arrays, right?) which don't let me use the OrderBy or else nothing about empty string[ ][ ] so I'm a bit stuck...
I found online if I use Linq I can use something like "OrderBy(entry => entry[0]).ToArray( )" to sort the grid supposedly based on the first column, but my problem actually is to create a string[ ][ ] which is empty and then I can populate with variable content (remember, I don't know how many rows I have, I also tried but failed to set a basic static size of 100 rows). Visual Studio doesn't exactly prompt errors in the code but instead on the execution. Meaning, I tried different things, first of all array.Append(string1, string2, string3, string4), which would be the 4 values of a row, assuming Append just inserts a string[ ] inside the string[ ][ ] (which should be empty), but when I test it with a MessageBox, recalling the value in array[0][1] it just doesn't work, saying I'm off the limits of the array.
Do you have any suggestions about this? I'm sure I'm going around the same error and I'm missing something basic, but searching online I couln't find anything about this specific case because I find only how to create string[ , ] (jagged arrays, right?) which don't let me use the OrderBy or else nothing about empty string[ ][ ] so I'm a bit stuck...