When declaring an array, add a pair of brackets after the variable type of each element.
Int [] intergers;
To initialize an array of a specific size, you can use the new keyword to specify the size in square brackets after the type.
Int [] integers = new int [2]
It can also be declared without initialization, And the size will be dynamically specified later.
Int [] integers;
Integers = new int [32];
When initializing an array, you cannot use variables to set how many elements the array should contain. However, you can declare a constant for the array length:
Const int Len = 3;
String [] strings = new string [Len];
You can use length to determine the array size.
Int arraylength = intergers. Length
Array. Sort (string) array in the forward order
Array. Reverse in reverse order
C # multi-dimensional array
C # supports two arrays. The first is a rectangular array.
String [,] strings;
C # The second supported multi-dimensional array is an orthogonal array.
Int [] [] A = new int [3] [];
A [0] = new int [4];
A [1] = new int [2];
A [2] = new int [1];
To declare an orthogonal 3D array, use
Int [] [] [] ints;
Aboat class
If methods do not attempt to access instance data or other instance methods, they can be declared as static.
If you do not want fields generated for each instantiation class to be declared as static
Non-static fields cannot be referenced for static classes.