Sunday, 15 January 2012

c# - How to create a new empty jagged array with same dimensions as another without loops -



c# - How to create a new empty jagged array with same dimensions as another without loops -

is possible without having utilize loop in source code?

t[][] output = new t[array.length][]; (int i=0; i<array.length; i++) { t[i] = new t[array[0].length]; }

or should write function it?

assume array rectangular in dimensions.

you can use:

t[][] output = enumerable.range(0, array.length) .select(x => new t[array[0].length]) .toarray();

but way using loops behind scenes..

c# arrays dimension

No comments:

Post a Comment