2012年5月7日

摘要: 4.排序操作符 OrderBy 作用:基于一个keySelector方法对输入序列进行排序,keySelector方法 将为每个输入元素返回一个键值,并会生成一个已排序的输出序列 IOrderedEnumerable<T>,这个输出序列将根据返回的键值按升序排列。 原型 public static IOrderedEnumerable<T> OrderBy<T, K>( th... 阅读全文
posted @ 2012-05-07 16:47 无名小虾 阅读(298) 评论(0) 推荐(0) 编辑
 
摘要: 3.分区操作符Take作用:可以返回来自输入序列中指定数量的元素,并从输入序列的第一个元素开始计数。简单的说就是获取序列中的前几项原型 public static IEnumerable<T> Take<T>( this IEnumerable<T> source,int count);例子 static void Main(string[] args) { string[] items = { "Hello World", "Welcome to MVC", "Linq to Sql"}; var 阅读全文
posted @ 2012-05-07 16:42 无名小虾 阅读(250) 评论(0) 推荐(0) 编辑
 
摘要: 2.投影操作符Select作用:从某种类型的元素组成的输入序列创建一个由其他类型的元素组成的输出序列。输入的类型和输出的类型不必相同。原型 public static IEnumerable<S> Select<T, S>( this IEnumerable<T> source, Func<T, S> selector); public static IEnumerable<S> Select<T, S>( this IEnumerable<T> source, Func<T, int, S> se 阅读全文
posted @ 2012-05-07 16:39 无名小虾 阅读(305) 评论(0) 推荐(0) 编辑