Linq查询与字符串值列表进行比较

Dhe*_*eyv 3 c# linq

我需要比较并从字符串列表中获取LINQ的匹配值.看看我的代码.

Split = Id.Split(',');
List<string> uids = new List<string>(Split);
var model = (from xx in Db.ItemWeedLogs
                where xx.ItemNo == uids   
                // I need to pass a string list to extract the matching record.
                select xx).ToList();
Run Code Online (Sandbox Code Playgroud)

Wah*_*tar 6

试试这个 :

var model = (from xx in Db.ItemWeedLogs
                     where uids.Contains(xx.ItemNo)
                     select xx).ToList();
Run Code Online (Sandbox Code Playgroud)