Sort And Reverse Method (Static Methods In Array Class)
Syntax for Sort Method is : - Sort(arrayname)
Syntax for Reverse Method is :- Reverse(arrayname)
------------------------------------------------------------------------------------------------------
using System;
class ReverseAndSortMethod
{
static void Main()
{
int[] arr = {32,45,67,23,65,3,45,23};
Console.WriteLine("Array before reserve and sort");
Console.WriteLine("--------------------------------------");
foreach(int i in arr)
{ Console.Write(i + "\t"); }
Console.WriteLine("\n--------------------------------------");
Array.Sort(arr);
Console.WriteLine("Array before reserve and after sort");
Console.WriteLine("--------------------------------------");
foreach(int i in arr)
{ Console.Write(i + "\t"); }
Console.WriteLine("\n--------------------------------------");
Array.Reverse(arr);
Console.WriteLine("Array after reserve and after sort");
foreach(int i in arr)
{ Console.Write(i + "\t"); }
Console.WriteLine("\n--------------------------------------");
}
}
------------------------------------------------------------------------------------------------------
Sort And Reverse Method (Static Methods In Array Class)
Reviewed by Baljeet Singh
on
08:02
Rating:
![Sort And Reverse Method (Static Methods In Array Class)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1i2B6PAhn66hQ5gyEDYpXrGH1gkQkxlm6Azjm0CyLipVzEfVhK2J9pBp8wlx5aN9Nq6n7by5a7dq-JK3hzMlADg0OCze84h8p8D-MYlWQc8vZgEWrXp0ciLk5bvTqo49Whvvy4kpVpETU/s72-c/img.png)
No comments: