int[] numbers = { 1, 2, 3, 4, 5 }; int sum = numbers.Aggregate((a, b) => a + b); // Output: 15
double[] numbers = { 1, 2, 3, 4, 5 }; double average = numbers.Aggregate((a, b) => a + b) / numbers.Length; // Output: 3
int[] numbers = { 1, 2, 3, 4, 5 }; int max = numbers.Aggregate((a, b) => a > b ? a : b); // Output: 5These examples demonstrate how to use System Aggregate to perform different calculations on collections of data. The System Aggregate package library is part of the .NET framework and is included in the System.Linq namespace.