This query just doesnt seem to be very happy. Any ideas anyone?
var results = from a in previousQuery
join b in dtCounties.AsEnumerable()
on new { a.CountyCode, a.StateCode } equals new {
b.Field<string>("COUNTYCODE"),
b.Field<string>("StateCode")
}
where b.Field<bool>("TrueOrFalse") == true
select new
{
CountyCode = a.CountyCode,
TrueOrFalse= b.Field<bool>("TrueOrFalse"),
Sum= a.Sum
};
The error I get is
“Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.”
for the 2 columns in the right hand side of the join (ie b.Field<string>("COUNTYCODE") and b.Field<string>("StateCode")).
This is just a C# syntax issue, not LINQ itself. Consider the following:
Just to clarify, here is the result of the above: