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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -