Extension methods must be contained in a public static class. This solution uses the following declaration for its StatisticsExtensions class:
public static class StatisticsExtensions{ ...}
Extension methods must also be declared as public and static. Their first parameter should be marked with the this keyword to indicate that the parameter is the object that is being extended.
The following code shows the TruncatedMean extension method:
// Return the truncated mean of an IEnumerable of numbers.// Set discardNumber to the number of values to discard at the// top and bottom. For example, set discardNumber = 5 to// discard the 5 largest and smallest values.public static double TruncatedMean<T>(this IEnumerable<T> values, ...