Linq-aggregation
提供:Dev Guides
LINQの集約
任意のタイプの必要な集計を実行し、LINQでカスタム集計を作成できます。
Operator | Description | C# Query Expression Syntax | VB Query Expression Syntax |
---|---|---|---|
Aggregate | Operates on the values of a collection to perform custom aggregation operation | Not Applicable | Not Applicable |
Average | Average value of a collection of values is calculated | Not Applicable | Aggregate … In … Into Average() |
Count | Counts the elements satisfying a predicate function within collection | Not Applicable | Aggregate … In … Into Count() |
LonCount | Counts the elements satisfying a predicate function within a huge collection | Not Applicable | Aggregate … In … Into LongCount() |
Max | Find out the maximum value within a collection | Not Applicable | Aggregate … In … Into Max() |
Min | Find out the minimum value existing within a collection | Not Applicable | Aggregate … In … Into Min() |
Sum | Find out the sum of a values within a collection | Not Applicable | Aggregate … In … Into Sum() |
例
VB
上記のVBコードがコンパイルおよび実行されると、次の結果が生成されます-