Linq Join Null Reference
我的查询如下:
1 2 3 4 5 | (from c in countries join r in Db.PaymentRates_VisaImmigrationPermit on c.CountryId equals r.HomeCountryId into countryRates from legalRate in countryRates.DefaultIfEmpty() join hostC in Db.Countries on legalRate.HostCountryId equals hostC.Id select new [...] |
我在此行上得到一个空引用异常:
1 | join hostC in Db.Countries on legalRate.HostCountryId equals hostC.Id |
...这显然是由以下行引起的:
1 | from legalRate in countryRates.DefaultIfEmpty() |
仅当
类似的问题:LINQ中的错误Left Join
您可以使用
1 2 |