Questions tagged «icomparer»


3
使用Lambda表达式代替IComparer参数
C#是否可以在方法调用中将Lambda表达式作为IComparer参数传递? 例如类似 var x = someIEnumerable.OrderBy(aClass e => e.someProperty, (aClass x, aClass y) => x.someProperty > y.SomeProperty ? 1 : x.someProperty < y.SomeProperty ? -1 : 0); 我不能完全编译它,所以我猜不是,但是在lambda和匿名委托之间似乎有如此明显的协同作用,我觉得我一定做错了。 TIA
76 c#  lambda  icomparer 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.