c# - Creating multidimensional array at runtime -


i did research on web couldn't find advice how dynamically create multidimensional (rank >1) array (it jagged array).

in other words program ask number of dimensions (rank) first, number of elements per dimension (rank) , create array.

is possible?

multidimensional no, no problem jagged - here simple example:

using system; using system.collections.generic;  public class program {     public static void main()     {          list<list<list<int>>> myjaggedintlist = new list<list<list<int>>>();          myjaggedintlist.add(new list<list<int>>());         myjaggedintlist[0].add(new list<int>());         myjaggedintlist[0][0].add(3);          console.writeline(myjaggedintlist[0][0][0].tostring());     } } 

each item in first list list, each item in second list list, , each item in third list int. what's problem that?

play in fiddle.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -