您将如何将此 linq 表达式的选择部分具体翻译为 lambda?
var query2 = from method in typeof(double).GetMethods() // integrated method c# reflection
orderby method.Name
group method by method.Name into groups
select new { MethodName = groups.Key, NumberOfOverloads = groups.Count()};
到目前为止,我有这个:
var methods = typeof(double).GetMethods();
var query3 = methods.OrderBy(x => x.Name).GroupBy(y => y.Name);
我为选择尝试了这个,但我得到了编译器错误。
var query3 = methods.OrderBy(x => x.Name).GroupBy(y => y.Name)
.Select<new { MethodName = groups.Key, NumberOfOverloads = groups.Count()}>();
感谢帮助谢谢。