Select dynamically how to sort a list

added by brandewinder
11/7/2010 11:51:39 AM

0 Kicks, 83 Views

Sorting lists of items using LINQ is straightforward, by applying OrderBy, using whatever item property you want. However, I recently had to solve a slightly more complex problem: providing the user with the ability to select between multiple sorting criteria. How could we implement this without code duplication?