The array is the most basic data collection provided by. NET, which accesses the collection elements directly through the index. Provides one-dimensional or multidimensional data storage and supports operations such as, querying, searching, sorting, copying, and so on.
The main interfaces provided, according to the semantic division, mainly include:
Also can hit Baidu brain map View:
Http://naotu.baidu.com/file/f879a94fe2163c365cc22f4e4bbcc7dc
One-dimensional array declaration, creation, initialization:
1) directly within the initializer:
Int[] MP = new Int[6] {-50,-30,-10, 10, 30, 50};
2) Assign values separately:
Mp[0] = -50; MP[1] = -30; MP[2] = -10; MP[3] = ten; MP[4] =; MP[5] = 50;
As shown, the number of one-dimensional graphs is 0,1,2,3,4,5
Multidimensional (for example, two-dimensional) array declaration, creation, initialization: (as shown, two-dimensional numbering is 0,1,2,3,4,5)
int[,] point = new int[2, 6] { {-50,-30,-10, 10, 30, 50},//No. 0 dimension {50, 30, 10, 10, 30, 50}//1th dimension };
Initialize separately:
Point 0 point[0, 0] = -50; point[1, 0] =; Point 1 point[0, 1] = -30; Point[1, 1] =; Point 2 point[0, 2] = -10; Point[1, 2] = ten; Point 3 point[0, 3] = ten; Point[1, 3] = ten; Point 4 point[0, 4] =; Point[1, 4] =; Point 5 point[0, 5] =; Point[1, 5] = 50;
The semantic differences between one-dimensional and multidimensional-interface methods were compared:
Gets the number of elements of a dimension int mpLen0 = MP. GetLength (0);//6 int pointLen0 = point. GetLength (0);//2 int pointLen1 = point. GetLength (1);//6 //Gets the subscript maximum value of a dimension int mpupperbound = MP. GetUpperBound (0); 5 int pointUpperBound0 = point. GetUpperBound (0);//1 int pointUpperBound1 = point. GetUpperBound (1);//5 //Gets the subscript minimum value for a dimension int mplowbound = MP. Getlowerbound (0);//0 int pointLowBound0 = point. Getlowerbound (0);//0 int pointLowBound1 = point. Getlowerbound (1);//0 //Gets the total number of elements of all dimensions int mplen = MP. LENGTH;//6 int pointlen = point. LENGTH;//12 //Gets the number of dimensions int mprank = MP. RANK;//1 int pointrank = point. Rank;//2
Summary
1 array at compile time must determine the element of each dimension element number, this is its biggest flaw, for the runtime to determine the number of elements of a dimension, this data structure can not meet the conditions!
2 when the array is created, the type is strongly typed and must be specified.