2-Dimension array of List in C#?
arrays, c#, list
Solution
What do you mean by "doesn't work"? What error are you getting?
I don't know about Mono (or Unity3D), but I just tried the following in a .NET project and got the results I expected:
List<string>[,] strings = new List<string>[2, 2];
strings[0, 0] = new List<string> { "One" };
strings[0, 1] = new List<string> { "Two" };
strings[1, 0] = new List<string> { "Three" };
strings[1, 1] = new List<string> { "Four" };
Problem
I just want get a 2 dimension array of List in c#. In my thought, below should works but it didn't, the 1 dimension array of List works. I use Unity3D with Mono, however I think it's language related problem. ``` List<MyType>[,] twoDArrayofList;//don't work, it's type is List<MyType> List<MyType>[] oneDArrayofList;//it's works, the type is List<MyType> ``` Anyone know what's wrong? Thank you.