Sorting an array in c#
Hi,
Here is a simple way to sort an array. We can use the Array.Sort() function for applying the sorting. Here I am going to display a short code snippet for your use. Try and and post your comments here. If any suggestions or need some clarifications
using System;
class SortReverse{
public static void Main()
{
int[] x={30,10,80,90,20};
Console.WriteLine("Array Before Sorting");
foreach(int i in x)
Console.Write(" "+i);
Console.WriteLine();
Array.Sort(x);
Console.WriteLine("Array After Sorting");
foreach(int i in x)
Console.Write(" "+i);
Console.WriteLine();
Array.Reverse(x);
Console.WriteLine("Array After Reversing");
foreach(int i in x)
Console.Write(" "+i);
Console.WriteLine();
}
}
Thanks
Anil Kumar Pandey
System Architect
Green Point Technology (India) Ltd.
Mumbai, Maharshtra
INDIA
Popularity: 10%
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.











Hi Anil,
Good work. Its a nice code presented by you.
Welcome to MsDnM.
Keep it up!
Best of luck!
Gaurav Arora
Thanks for your valuable comment, i will keep posting codes like this..
Cool post, just subscribed.
Thanks for your appreciation….
Leave your response!
You must be logged in to post a comment.
Member Area
Register | LoginWho's Online
Our Network
Most Popular Post
Most Viewed Posts
History
Top Members
Categories
Your opinions
Most Commented
Most Viewed