不相交联盟LINQ [英] Disjoint Union in LINQ

查看:170
本文介绍了不相交联盟LINQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两套(ILists),我需要从第一个列表,其中项目不在第二个列表中的所有项目。

I have two sets (ILists) where I need all the items from the 1st list, where the item is not in the second list.

任何人都可以点我有一个LINQ语句实现这一目标的最佳方法是什么?

Can anyone point me to the best way of achieving this with a LINQ statement?

推荐答案

怎么样的<一个href="http://msdn.microsoft.com/en-us/library/system.linq.enumerable.except.aspx"><$c$c>Except方法:

How about the Except method:

var firstMinusSecond = first.Except(second);

这篇关于不相交联盟LINQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆