The so-called array, which is the set of elements of the same data type, is arranged in a certain number of numbers, that is, a variable of the same type is named with a name, and then the set of the variable is distinguished by the number, the name becomes the array name, and the number is called the subscript. The variables that make up the array are the components of the array, also known as the elements of the array, sometimes referred to as subscript variables, which are in the program design and, for ease of handling, a form of organizing several variables of the same type in an orderly form. The collection of these ordered, homogeneous data elements becomes an array.
Arrays are also divided into one-dimensional arrays, two-dimensional arrays, multidimensional arrays
A one-dimensional array is indexed by an integer, and the multidimensional array is indexed by two or more integers.
One, data type [] Variable name = new data type [length];
II, string[] sss = new string[] {"AAA", "BBB", "CCC", "ddd", "Eee", "FFF"};
III, string[] sss = new String[5] {"AAA", "BBB", "CCC", "ddd", "Eee"};
Assignment variable name [index] = value of one-dimensional array;
The value variable of one-dimensional array = variable name [index];
int A; int[] sz = new Int[3] {1, 5, 7};//define an array a = sz[0];//define an empty variable to swap the first variable out sz[0] = sz[2];//Change the first variable to a third sz[2] = a ;//Replace the third one with the first for (int i = 0; i < sz. Length; i++) Console.Write (Sz[i]); Console.ReadLine ()
Two-dimensional arrays:
int []a=new string[2,2]{{1,2},{3,4}};
This is a two-dimensional array, [2,2] the first 2 in parentheses means there are two one-dimensional arrays, and the 2nd 2 means that there are two variables in a one-dimensional array
three-dimensional array : Int[]a=new string[2,2,2]{{{1,2},{3,4}},{{5,6},{7,8}};
Three-dimensional array "2,2,2"
The first represents a total of 2 two-dimensional arrays, and the second 2 indicates that each of the two-dimensional arrays has two one-dimensional arrays;
C # One-dimensional arrays, two-dimensional arrays, multidimensional arrays