-
Notifications
You must be signed in to change notification settings - Fork 4
ArrayInitializer
Mehdi Mohammadi edited this page Dec 29, 2013
·
1 revision
Jagged array is a multi dimensional array, which number of columns maybe different in each row. In Java you can initialize jagged arrays rows and columns with specialized syntax which is not available in C#:
int[][] arr = new int[][]{{1, 2}, {3, 4, 5}};
We translate item initializers to separated new statements:
int[][] arr = new int[][];
arr[0] = new int[] {1, 2};
arr[1] = new int[] {3, 4, 5};