A cool List .Sort() extension method via lambda

Here’s an awesome List<T>.Sort() extension method:

public static List<T> Sort<T,U> ( this List<T> Source, Func<T,U> OrderFunc ) {
    return Source.OrderBy( OrderFunc ).ToList();
}

Use it with a lambda like this:

MyList mylist = PopulateList();
mylist = mylist.Sort( i => i.Sequence );

Or like this for non-Enums:

MyList<int> mylist = PopulateList();
mylist = mylist.Sort( i => i );

Now that’s a cool sort function!

Rob