从sql到LINQ2sql的后退有时非常简单.以下声明
SELECT user FROM users WHERE lastname='jones'
很容易翻译成
from u in users where u.lastname='jones' select u
SELECT user FROM users WHERE lastname IN ('jones','anderson')
解决方法
我不得不做一些搜索才能找到它,并认为它可能对其他人有用.
List<string> names = new List<string>() { "jones","anderson" }; from u in users where names.Contains(u.lastname) select u