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});
原文地址:https://www.cnblogs.com/IIXS/p/14733509.html