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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -