C#:LINQ中的IN子句

如何使where in子句类似于SQL Server中的in子句?

 1 var results = from states in _objectdatasource.StateList()
 2               where listofcountrycodes.Contains(states.CountryCode)
 3               select new State
 4               {
 5                   StateName = states.StateName
 6               };
 7 // OR
 8 var results = _objectdatasource.StateList()
 9                   .Where(s => listofcountrycodes.Contains(s.CountryCode))
10                   .Select(s => new State { StateName = s.StateName});

 

C#:LINQ中的IN子句

上一篇:微软的AJAX--使用ActiveXObject 读取WebService


下一篇:Liferay7 BPM门户开发之32: 实现自定义认证登陆(定制Authentication Hook)