我正在使用LINQtoSQL,我想返回CSV匹配记录的列表,其中包含要匹配的ID列表。下面的代码是我的出发点,在一个字符串数组已经变成一个CSV字符串,然后进入一个泛型列表(我认为LINQ想) - 但事实并非如此:LINQ-to-SQL:使用CSV进行搜索
错误
Error 22 Operator '==' cannot be applied to operands of type 'int' and 'System.Collections.Generic.List<int>' C:\Documents and Settings\....\Search.cs 41 42 C:\...\
代码
DataContext db = new DataContext();
List<int> geographyList = new List<int>(Convert.ToInt32(geography.Split(',')));
var geographyMatches = from cg in db.ContactGeographies
where cg.GeographyId == geographyList
select new { cg.ContactId };
我在哪里何去何从?
这样做的窍门 - 这个语法对我来说看起来很奇怪,但是我看看LINQ奇怪的SQL眼睛,它使我对这些类型的方法 – 2010-03-09 11:23:56