我正在通过实践学习LINQ。这似乎是我应该能够使用它的情况,但我无法确定是否可能或者我是否在错误的方向上努力。
在下面的用例中,我能否使用一行LINQ查询实现方括号[]中的内容?
在下面的用例中,我能否使用一行LINQ查询实现方括号[]中的内容?
List<Command> list1, list2;
PopulateCommandLists(list1, list2);
foreach(Command cmd in list1)
{
if ([cmd.Name is present as the Name in any of list2's Command objects])
{
//some code.
}
}