we can think of an array as a sequence of elements. All elements have the same type. We can build simple arrays that have one dimension(list), two dimension(table).
Every element in the array contains a value.
Arrays are zero-Indexed. The first item an array is element zero.
the rank of an array is the number of dimensions in the array.
Arrays of a particular type can only hold elements of that type.If we need to manipulate a set of unlike objects or value types,we could use one of the collection types that are defined in the System.Collections namespace.
If we do not initialize the elements in a array,the C# compiler initializes them for we automatically when the array is created. For example The array contains number data, all elements will be initialized to zero or if it contains string data, all elements will be initialized in null:
the var keyword instructs the compiler to infer the type of the variable from the expression on the right side of initialization statement.
For example:
var number=1; implicitly type
int number= 1; explicitly type
var name="Mary"; string name="Mary";
It depends on the value which is assigned, this will store only this type.
var number = new int[] { 1, 2, 5 }; all elements are integers.
new type[]--> reserve enough space in order to store this elements.
Methods and Properties that have an array
BinarySearch() Method:To search a sorted single-dimensional
Clone() Method:
CopyTo() Method:
Rank Property:
SetValue() Method:
This methods is similar to
number[3]=500;
GetValue() Method:
this methods is similar to
int num=number[3]
short()Method:








No hay comentarios:
Publicar un comentario