Sort the elements in the entire ArrayList in CSharp
Description
The following code shows how to sort the elements in the entire ArrayList.
Example
using System;/*from ww w . j ava2 s. c o m*/
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class MainClass
{
public static void Main()
{
ArrayList arraylist = new ArrayList(4);
arraylist.Add("M");
arraylist.Add("K");
arraylist.Add("A");
arraylist.Add("A");
arraylist.Sort();
foreach (string s in arraylist)
{
Console.WriteLine(s);
}
}
}
The code above generates the following result.