Five ways to declare a C # array
First, declare an uninitialized array reference, you can later make this reference to an array instance
Int[] Intarray;
Intarray = new INT[10];
Note: The reference to an array must be instantiated with the same or related type, the initial default value of the array, the value type 0, and the reference type NULL
Second, declare an array reference and make an initial representation of it, and the array reference is immediately given a new instance of the array.
int[] Intarray = new INT[10];
Declare an array, initialize the array references, and assign values to the array elements
int[] Intarray = new Int[3] {n-only};
Note: The initial list is separated by a comma (,), and the number in the list must match the length of the array.
Four, and the third way basically the same, just do not set the initial size of the array, determined by the array elements.
int[] Intarray = new int[] {n-only};
This is a simplified version of the fourth way, where the array type and the array size are inferred from the initial list.
Int[] Intarray = {n/a};
Multidimensional data
Multidimensional arrays are rectangular arrays, there are multiple dimensions and indexes, dimensions are separated by commas in [], "[,]", for example the most
Common two-dimensional arrays:
int[,] Intarray = new int[2,3] {{1,2,3},{4,5,6}};
Jagged arrays
A jagged array is considered an array of arrays, and each vector of a jagged array can have a different length.
You should first define the rows in the jagged array (the number of vectors), and then declare the number of elements per row
int[][] Intarray = new Int[2][]{new int[]{1,2,3},new int[] {1,2,3,4}}
Note the difference from a two-dimensional array