Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
hi
how to enter values into array and sort the array using code..
any one will help??
Posted
Comments
[no name] 1-Dec-11 4:25am    
google should not be your last option.

Use the Array.Sort method. For its various method parameters, see here[^].
For a simple example, visit here[^].
 
Share this answer
 
use Array.Sort() method
C#
static void Main()
    {
	string[] a = new string[]
	{
	    "delhi",
	    "mbd",
	    "bly",
	    "rmp",
	    "gzb",
	};
	Array.Sort(a);
	foreach (string s in a)
	{
	    Console.WriteLine(s);
	}

or you can use sorting algorithm in C#
Bubble Sort in C#
Insertion sort
for more try Google
 
Share this answer
 
Comments
ythisbug 1-Dec-11 5:07am    
i need code for asp.net..
uspatel 1-Dec-11 5:24am    
logic will be same for asp.net.try with asp.net with C#
 
Share this answer
 
Interview Question.
Read a book or read online on Arrays.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900