c# - How convert a list to int[][] -


i have class piece define each piece shape.

myshape.add(new piece         {             height = 3,             width = 2,             name = "3x2 l topright",             size = 4,             shape = new int[][] {                         new int[] { 1, 0 },                         new int[] { 1, 0 },                         new int[] { 1, 1 }                     }         }); 

but create shape hand, reading pieces in real time, create like

list<int[]> virtualrow = new list<int[]>(); virtualrow.add(new int[] { 1, 0 }); virtualrow.add(new int[] { 1, 0 }); virtualrow.add(new int[] { 1, 1 }); 

so how can create shape using virtualrow ?

i try

shape = new int[][] { virtualrow.toarray() } 

but cannot implicitly convert type 'int[][]' 'int[]'

virtualrow.toarray() already array of array of int values. don't need create new array of array of ints , add it.

all need is:

shape = virtualrow.toarray(), 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -