I am trying to write the following Linq (query style) in 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 that the Join() extension method does not provide a way to get the joined collection.
I also searched online but could not find any leads. Please feel free to suggest.
join ... into, which is represented withGroupJoin, notJoin.