摘要: 最近项目中用到了Linq中Except,Distinct,Left Join这几个运算,这篇简单的记录一下这几种情形。 Except 基础类型使用Linq的运算很简单,下面用来计算两个集合的差 int[] a = {1, 2, 3, 4}; int[] b = {2, 3, 4, 5}; var reslut = a.Except(b); result 用来返回a有,b没有的值,计算结果是1。 自定义类型实现Except class Employee { public int ID { get; set; } } 对于引用类型,若需要根据属性进行Except运算,则看下面简单的例子 List. 阅读全文
posted @ 2011-02-24 09:18 ringgo 阅读(11104) 评论(0) 推荐(1) 编辑