How to Sort ArrayList in C#


You have an ArrayList collection in your program and you want to sort its elements based on their natural order.

ArrayList list = new ArrayList(); 

list.Add("Terminator 2"); 
list.Add("Jurassic Park"); 
list.Add("Die Hard 4"); 
list.Add("Titanic"); 

list.Sort();

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Add Comment