I've had a look at both ASP.Net c# adding items to jagged array and vb.net assign array to jagged array but I just can't seem to work this out...
So, essentially, it's this. I have a function that builds a list of values from a query or two. I'm adding each value returned to a list then converting the list to an array. All is good
However, I now need to return two values, so a multi dimension array appears more suitable. Essentially, this is what I want to do:
string[][] array2D = new string[2][];
array2D[0] = new string[3] { "one", "two", "three" };
array2D[1] = new string[3] { "abc", "def", "ghi" };
All good so far. However, I don't know the values that I want to plug in to the array at the time of array initialisation, so, this is what I'd expect to be able to do:
string[][] array2D = new string[2][];
//array2D[0] = new string[3] { "one", "two", "three" };
//array2D[1] = new string[3] { "abc", "def", "ghi" };
string[] deviceIDS = { "one", "two", "three" };
string[] groupIDS = { "abc", "def", "ghi" };
array2D[0] = new string[deviceIDS.Length] deviceIDS;
array2D[1] = new string[deviceIDS.Length] groupIDS;
But it really doesn't like the last two lines, report it needs a ;
array2D[0] = deviceIDS; array2D[1] = groupIDS;?