Possible Duplicate:
Sorting an IList in C#
I have an IList<Keyword>
where Keyword is a class containing a title(string) and a key(number). I wish to sort this IList based on the key. Is there an inbuilt C# functionality that I can use?
You need to add: using System.Linq;
IList<keyword> sortedList = list.OrderBy(r => r.key).ToList();
Or you can try:
IList<keyword> sortedList2 = (from r in list
orderby r.key
select r).ToList();