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?
Comments
Post a Comment