Is there a way in C# to initialize jagged arrays similarly as in Java -


in java, can following:

string[][] map = {         {"1.0, ", "1.1, ", "1.2, ", "1.3, ", "1.0, "},         {"a, ", "b, ", "c, ", "d, ", "e, "},         {"x, ", "xx, ", "xxx, ", "xxxx, ", "xxxx, "},                      }; 

but same code not compile in c#. in tedious way initializing sub-fields 1 one sure there better way.

the closest thing can in c# add new [] before each array initializer:

string[][] map = {                     new [] {"1.0, ", "1.1, ", "1.2, ", "1.3, ", "1.0, "},                     new [] {"a, ", "b, ", "c, ", "d, ", "e, "},                     new [] {"x, ", "xx, ", "xxx, ", "xxxx, ", "xxxx, "},                  }; 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -