Pieter Brinkman Blog

Asp.net: Sort generic list with a delegate.

1 min readpieterASP.Net

You can use a delegate to sort a generic list. Example

GenericList ObjectItem = new GenericList ObjectItem() GenericList.Sort(delegate(ObjectItem i1,ObjectItem i2) {
 return i1.SortProperty.CompareTo(i2.SortProperty);
});