Monday, 15 September 2014

c# - Linq "join" or "GroupJoin" not compiling?? "Cannot resolve symbol 'GroupJoin'" -



c# - Linq "join" or "GroupJoin" not compiling?? "Cannot resolve symbol 'GroupJoin'" -

maybe eyes crossed i've been coding day, decided utilize linq look , doesn't compile on keywords... note works in linqpad.

using system.linq; public iqueryable<companyperson> personsflattened() { var contacts = person in person bring together companyperson in companyperson on person.id equals companyperson.personid companypersongroups companyperson in companypersongroups.defaultifempty() select new { contactperson = person, contactcompany = companyperson.company }; }

for reason "join" on line 2 gives me error

"cannot resolve symbol 'groupjoin'"

.

i've tried other way.

var contacts2 = person.groupjoin(companyperson, person => person.id, companyperson => companyperson.personid, (person, companypersongroups) => new { person = person, companypersongroups = companypersongroups } ).selectmany( temp0 => temp0.companypersongroups.defaultifempty(), (temp0, companyperson) => new { contactperson = temp0.person, contactcompany = companyperson.company } );

and same thing, thoughts? missing reference have have expressions? traversed through object explorer didn't see didn't have included. it's web api 2 project .net 4.5

it's because you're providing type companyperson rather value first argument:

var contacts2 = person.groupjoin(companyperson, person => person.id, companyperson => companyperson.personid, (person, companypersongroups) => new { person = person, companypersongroups = companypersongroups } ).selectmany( temp0 => temp0.companypersongroups.defaultifempty(), (temp0, companyperson) => new { contactperson = temp0.person, contactcompany = companyperson.company } );

c# linq lambda

No comments:

Post a Comment