In the array object in C #, you can use the reverse () method to reverse the element order in the array. The reverse () method is a static method, so as a parameter, the array elements that need to be reversed are passed to the reverse () method.
Array. Reverse (interger );
The sort () method can be used to sort the elements of an array.
Array. Sort (integer );
Consider an example where the student scores are stored in the array and data needs to be sorted to determine the highest score and the lowest score.
Using System;
Using System. Collections. Generic;
Using System. text;
Namespace Leleapplication2
{
Class Program
{
Static Void Main ( String [] ARGs)
{
Int [] Marks = {70,75,84,53,46,90,25} ;
Int I = Marks. length;
Console. Write ("Initial sorting: 70, 75, 84, 53, 46, 90, 25");
System. Threading. thread. Sleep (2000);
Array. Sort (marks );
Console. writeline ("");
Console. writeline ("Sorted in ascending order:");
System. Threading. thread. Sleep (2000);
For ( Int X = 0 ; X < I; x ++ )
{
Console. writeline (Marks [x]);
System. Threading. thread. Sleep (1000);
}
Console. Read ();
}
}
}