Did it with .NET - A Higher Calling (revisited)

… already have equivalents in the .NET Framework 3.5.

1. Filter = Where

2. Map = Select

3. Reduce = Aggregate

Each of these are implemented as extension methods for IEnumerable. So, we can rewrite the code like this:


static void Main()
{

var numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
var sum = numbers.Where(x => (x % 2) == 0).Select(x => x * x).Aggregate(0, (x, y) => x + y);
Console.WriteLine(”Sum: {0}”, sum);

}