c# - Translating to lambda expression -
how translate select part of linq expression lambda?
var query2 = method in typeof(double).getmethods() // integrated method c# reflection orderby method.name group method method.name groups select new { methodname = groups.key, numberofoverloads = groups.count()}; so far have this:
var methods = typeof(double).getmethods(); var query3 = methods.orderby(x => x.name).groupby(y => y.name); i tried select compilor errors.
var query3 = methods.orderby(x => x.name).groupby(y => y.name) .select<new { methodname = groups.key, numberofoverloads = groups.count()}>(); would appreciate thanks.
this exact translation. have no idea why need orderby tho, considering not using elements in select
var methods = typeof(double).getmethods() .orderby(x=>x.name) .groupby(x=>x.name) .select(x=> new { methodname = x.key, numberofoverloads = x.count()}); the same result obtained by
var methods = typeof(double).getmethods() .groupby(x=>x.name) .select(x=> new { methodname = x.key, numberofoverloads = x.count()}); and save computational time since don't have order collection.
Comments
Post a Comment