How can I sort List<T> based on properties of T ?

28. February 2013

A very good answer to this problem is provided on this blog post .

http://stackoverflow.com/questions/605189/how-can-i-sort-listt-based-on-properties-of-t

 

_list.Sort((a,b)=> String.Compare(a.Name,b.Name));

 

_list.Sort((a,b)=> a.SomethingInteger.CompareTo(b.SomethingInteger));

C# ,