Given a linq expression of an object collection 'items' such as this:
var total = (from item in items select item.Value).Distinct().Count()
Is it possible to convert this to use linq functions/lambdas:
items.Select(???).Distinct().Count()
Given a linq expression of an object collection 'items' such as this:
var total = (from item in items select item.Value).Distinct().Count()
Is it possible to convert this to use linq functions/lambdas:
items.Select(???).Distinct().Count()
It must be possible, since behind the scenes, LINQ is translated to lambdas and expression trees (at least LINQ to objects)
In your case the
???
part would beitem => item.Value
, i.e. foritem
, outputitem.value
. So, the whole expression will beUse this: