Advanced features and C # project combat Day2

In  C #, arrays are actually objects. System.Array  is the abstract base for all types of array types. To create, operations, methods of searching and sorting arrays, which serves as the base class for all arrays in the common language runtime. So all arrays can use its properties and methods. 

Here are some common attributes and methods: 
the Length Attribute: represents the total number of elements in the array dimension. 
Such as: 
    int [] = {1,2,3,4} Number; 
    number.Length value. 4; 

Rank properties: represents the number of dimensions in the array. 
Such as: 
    String [,] = names new new String [5,4-]; 
    names.Rank is 2. 

Sort method: sort of one-dimensional array. It is a static method Array class. 
As: 
    String [] = new new name String [] { "XI", "Ang", "Zhang", "Chun"}; 
    Array.Sort (name); 
    the foreach (String name in S ) 
    { 
       Console.WriteLine (S); 
    }

Reverse method: reverse one-dimensional array 
as 
    Array.reverse (name); 

GetLowerBound and GetUpperBound Method: lower and upper limits of the specified dimension of the array 
, such as: 
int [,,] = Number new new int [4,3,2] {{{. 1 , 2}, {2,3}, {3,4}}, {{4,5}, {5,6}, {6,7}}, {{7,8}, {8,9}, 9, 10 are}} {, 10, 11 are {{}, {11, 12}, {12, 13 are}}}; 
   
  for (int I = number.GetLowerBound (0); I <= number.GetUpperBound (0); ++ I) 
  { 
   for (int number.GetLowerBound J = (. 1); J <number.GetUpperBound = (. 1); J ++) 
   { 
    for (int number.GetLowerBound = K (2); K <= number.GetUpperBound (2); ++ K) 
    { 
     Console.WriteLine ( "Number [{0}, {. 1}, {2}] = {}. 3", I, J, K, Number [I, J, K]); 
    } 
   } 
  }

Clear method reinitialize the array all elements in the array to a series of elements is set to zero, to false  , or null reference.

Guess you like

Origin www.cnblogs.com/wmm0105/p/11166030.html