I thought this was straight forward, but given a multi-dimensional array
string[,] table = new string[,]
{
{"Apple", "Banana", "Clementine", "Damson"},
{"Elderberry", "Fig", "Grape", "Huckleberry"},
{"Indian Prune", "Jujube", "Kiwi", "Lime"}
};
How can I return a specific array using an index?
I tried the following but it does not work.
string[] firstArray = table[0];
Thank you.
Forr you the best approach is an extension method on array.Then you can invoke it in everywhere.
see below.Since you may have many such arrays in your project once you implement an extension method you can apply to any array as table.method(row)