首页 > 代码库 > 聚合操作

聚合操作

聚合操作

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.

聚合操作