|
by skeet via Jon Skeet's Coding Blog : C# on 2/28/2008 12:32:18 AM
When talking about LINQ recently, I doodled an implementation of OrderBy on a whiteboard. Now, I know the real OrderBy method has to support ThenBy which makes life slightly tougher, but let's suppose for a moment that it didn't. Let's further suppose that we don't mind O(n2) efficiency, but we do want to abide by the restriction that the sort should be stable. Here's one implementation: public static IEnumerable<TSource> OrderBy<TSource,TKey> &nb
... [ read more ]
|
|