码迷,mamicode.com
首页 > 其他好文 > 详细

聚合操作

时间:2017-02-06 23:29:32      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:element   item   enum   comm   rate   com   count   ring   class   

聚合操作

Aggregate

Performs a custom aggregation operation on the values in the collection.

  1. IList<String> strList =newList<String>(){"One","Two","Three","Four","Five"};
  2. var commaSeperatedString = strList.Aggregate((s1, s2)=> s1 +", "+ s2);
  3. Console.WriteLine(commaSeperatedString);
  4. //Results
  5. One,Two,Three,Four,Five

Average

calculates the average of the numeric items in the collection.

Count

Counts the elements in a collection.

LongCount

Counts the elements in a collection.

Max

Finds the largest value in the collection.

Min

Finds the smallest value in the collection.

Sum

Calculates sum of the values in the collection.

聚合操作

标签:element   item   enum   comm   rate   com   count   ring   class   

原文地址:http://www.cnblogs.com/wuyicqb/p/6371957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!