c# - Linq join two objects of the same type -
how can work? keep getting error message r not exist in current context (where put **).
var query = ( p in prerequisiteslist join r in requirementstatus on p.id equals r.id temp r in temp.defaultifempty(new requirementstatus(p.id, p.name, p.description, **r.fulfilled**)) select new { p.id ,p.name ,p.description ,r.fulfilled }); both types same individual values overwritten.
the method defaultifempty provides left outer join. means fallback if join doesn't find match in right sequence. if right item null, cannot access it, right?
you have figure out else, because have made logical mistake.
maybe can solve providing default value?
something this:
temp.defaultifempty(new requirementstatus(p.id, p.name, p.description, false)) besides, right list named same requirementstatus type later used, makes example uncompilable. that's typo.
Comments
Post a Comment