Is it possible with C# to pass a lambda expression as an IComparer argument in a method call?
eg something like
var x = someIEnumerable.OrderBy(aClas
If you're on .NET 4.5, you can use the static method Comparer.Create.
Comparer.Create
Documentation: Comparer.Create Method .
Example:
var x = someIEnumerable.OrderBy(e => e.someProperty, Comparer.Create((x, y) => x.someProperty > y.SomeProperty ? 1 : x.someProperty < y.SomeProperty ? -1 : 0) );