string[] companyIdsUnfiltered = companyIdsCsv.Split(',');
高于我的代码和我的错误。
代码如下:
string[] companyIdsUnfiltered = companyIdsCsv.Split(',');
var query = (from c in ctx.Companies
join co in ctx.Countries on c.CountryId equals co.Id
where companyIdsUnfilteres.Contains(c.Id)
select c.Id).ToArray();
答案 0 :(得分:2)
鉴于错误,我猜解决方案是将c.Id
转换为字符串。
var query = (from c in ctx.Companies
join co in ctx.Countries on c.CountryId equals co.Id
where companyIdsUnfilteres.Contains((string) c.Id)
select c.Id).ToArray();
只是要添加,如果无法转换为string
,请尝试c.Id.ToString()
。并照顾空值等。