如何在Entity框架4.0中实现SQL“in”

如何在entity framework中实现SQL的以下查询。 SELECT * FROM Users WHERE UserID in (1,2,3,4)

我想做

 var users = from e in context.Users where e.UserId in (list of user ids) 

谢谢Ashwani

 var users = from e in context.Users where idList.Contains(e.UserId) 

试试这个:

 var identifiers = new[] { 1, 2, 3, 4 }; var users = from e in context.Users where identifiers.Contains(e.UserId);