Product

public static class MathExtensionMethods
{ 
    public static int Product(this IEnumerable<int> values)
    {
       return values.Aggregate((a, b) => a * b);
    }
}
Example:
Func<int,int> fac = n => Enumerable.Range(1, n).Product();

Description

Computes a product of all elements in the sequence.

Details

Double click on the code to select all.

 

;