Methods Of Array Object:
1-Copy Method
2-Reverse Methods
3-Sort Methods
4-Clear Method
1) Copy Method:
copy a range of element from array starting at the first element and paste them into another Array starting at the first element are called Copy Method .
2) Reverse Method:
Reverse the sequence of the element in the entire single dimensional array.
3) Sort Method :
Sorts the element in an entire single –dimensional array using the IComparable implementation of each element of the array.
4)Clear Method :
Sets a range of element in the array to zero to false ,or to null ,depending on the element type.
Example of array Method :
using System;
classMethodDemo {
static void Main() {
Int [] arr= {
14,57,87,56,85,24,35
}
;
for (int i=0;i<arr.GetLength;i++) {
Console.WriteLine(arr[i] +” “);
}
Console.WriteLine();
Array:Sort(arr);
foreach(int i in arr)
Console.Write(i+” ”);
Console.WriteLine();
Array.Reverse(arr);
foreach(int i in arr)
Console.Write(i+” “);
Console.WriteLine();
int[] brr =new int [8];
Array.Copy(arr,brr,4);
foreach(int i in brr)
Console.WriteLine(i+” ”);
Console.WriteLine();
Console.ReadLine();
}
}