随笔分类 - LINQ
摘要:首先定义一个简单类,并重写ToString方法。public class CommidityFilter { public string Property { get; set; } public string Characterist { get; set; } ...
阅读全文
摘要:LINQ提供了方便的语法和很多操作对象集合的有用的方法。但是,要让LINQ比较方法,如Distinct或Intersect能正确处理,类型必须要满足一些条件。让我们看看Distinct方法,它从集合中返回所有的不重复对象。List<int> numbers =newList<int> { 1, 1, 2, 3 };vardistinctNumbers = numbers.D...
阅读全文