Click or drag to resize

EnumerableExtensionsMedianT Method

Calculates the median of a list of at least 2 values.

Namespace:  TestHelperExtensions
Assembly:  CBI.TestHelperExtensions (in CBI.TestHelperExtensions.dll) Version: 2.1.0.1
Syntax
public static double Median<T>(
	this IEnumerable<T> values
)

Parameters

values
Type: System.Collections.GenericIEnumerableT
A list of numeric values for which the median is to be determined.

Type Parameters

T
Any numeric data type.

Return Value

Type: Double
A double containing the median value of the list of values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
The return type of this method has to be double rather than T because the median has to be interpolated if the list contains an even number of values.
See Also