What is the use of Sort method in List collection?

 Posted by Rajesh_Kumar on 1/18/2014 | Category: ASP.NET Interview questions | Views: 640 | Points: 40
Answer:

Sort method is used for Sorting List collection Items in Ascending Order.

For Example:-
List<int> lst = new List<int>();

lst.Add(2);
lst.Add(1);

lst.Sort();

foreach (int item in lst)
{
Response.Write(item);
}


Output will be 12


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response