This C# code snippet sorts the elements of an array into ascending order
public class ReverseArraySort
{
public static void Main()
{
string[] strings = {"beta", "alpha", "gamma"};
Console.WriteLine ("Array elements: ");
DisplayArray (strings);
Array.Sort (strings); // Sort elements
DisplayArray (strings);
}
public static void DisplayArray (Array array)
{
foreach (object o in array)
{
Console.Write ("{0} ", o);
}
Console.WriteLine();
}
}
Tuesday, June 24, 2008
Sort Array
Labels:
C#,
Code Snips
Subscribe to:
Post Comments (Atom)
1 comment:
great work techie
Tom
Post a Comment