I am trying to write the following Linq (query style) in a Lambda expression so that I can chain and make my code more compact:
var result = from p1 in defaults
join p2 in get on p1.PermissionName equals p2.PermissionName
into joined
select new
{
PermissionName = p1.PermissionName,
Permission = joined.Select(e => e.Permission == null ? false : true)
.SingleOrDefault()
};
I could only go this far:
var result = defaults.Join(get, defaultKey =>
defaultKey.PermissionName, getKey =>
getKey.PermissionName, (a, b) => new
{
PermissionName = a.PermissionName,
Permission = b.Permission
});
As you can see, the extension method Join()does not provide a way to get the collection joined. I also searched the Internet but could not find any links. Please feel free to suggest.
source
share