public class Test
{
int i;
string s;
}
List<Test> testList = new List<Test>(); //assume there are some values in it.
List<int> intList = new List<int>(){ 1,2,3};
如何使用linq将对象获取items from testList where i is in intList
。linq查询基于另一个列表从一个列表中进行选择
像List<Test> testIntList = testList.Where(t=>t.i in intList)
我不知道我是否理解这个权利。这是怎么知道我=>我是在这个特定的查询。它没有在任何地方定义 –
@Alex J - 表达式'i => i'是一个lambda表达式,它是它自己的定义。在这个查询中,它表示连接使用来自'intList'的值。 – Enigmativity