F
Frank Buss
I'm porting some JavaScript code to C# (and I'm new to C#). This is the
beginning of the JavaScript code:
var pos = [
[ [ 0, 0 ] ],
[ [ -10, 0 ], [ 10, 0 ] ],
[ [ -10, -7 ], [ 12, -7 ], [ 0, 7 ] ],
....
I managed to write it like this for C# :
int[][][] pos = new int[][][]{
new int[][] { new int[] { 0, 0 } },
new int[][] { new int[] { -10, 0 }, new int[] { 10, 0 } },
new int[][] { new int[] { -10, -7 }, new int[] { 12, -7 }, new int[] {
0, 7 } },
....
but this looks very ugly and unreadable. Is there a nicer way to write
it in C#, like in JavaScript?
beginning of the JavaScript code:
var pos = [
[ [ 0, 0 ] ],
[ [ -10, 0 ], [ 10, 0 ] ],
[ [ -10, -7 ], [ 12, -7 ], [ 0, 7 ] ],
....
I managed to write it like this for C# :
int[][][] pos = new int[][][]{
new int[][] { new int[] { 0, 0 } },
new int[][] { new int[] { -10, 0 }, new int[] { 10, 0 } },
new int[][] { new int[] { -10, -7 }, new int[] { 12, -7 }, new int[] {
0, 7 } },
....
but this looks very ugly and unreadable. Is there a nicer way to write
it in C#, like in JavaScript?