C# Lamda中类似于SQL 中的 In 功能

时间:2023-03-08 21:26:54

首先,在程序中接受一个数组

例如:int[] s=[1,2,3];

在Lamda表达式中使用如下:

db.userinfo.where(u=>s.Contains(u.id));

等同于sql语句:

select * from userinfo where id  in  (1,2,3)

相关文章