Thursday, 13 March 2008

How to sort a generic List

Brilliant article describing how to sort custom objects n a List:

http://dotnetslackers.com/community/blogs/simoneb/archive/2007/06/20/How-to-sort-a-generic-List_3C00_T_3E00_.aspx

For example:

members.Sort(delegate(IFolderExplorerHierarchyMember member1, IFolderExplorerHierarchyMember member2)
{
return member1.Name.CompareTo(member2.Name);
});

No comments: