Location > Blog

Posts From February, 2010

Sort a generic collection dynamically by class properties

Sorting items in a database using SQL is easy, simply order by whatever field you want that supports sorting, its easy to take that power for granted. But what if you already have your data in the form of a generic object collection which you want to sort. It turns out to be quite simple, all you need to do is create a collection of System.Collections.Generic.List and call the Sort() method.