EnumerableExtensionsAverageTNumeric Method

Computes the average of a sequence of numeric values.

Definition

Namespace: Jodosoft.Numerics
Assembly: Jodosoft.Numerics (in Jodosoft.Numerics.dll) Version: 2.0
public static TNumeric Average<TNumeric>(
	this IEnumerable<TNumeric> source
)
where TNumeric : struct, new(), INumeric<TNumeric>

Parameters

source  IEnumerableTNumeric
A sequence of TNumeric values to calculate the average of.

Type Parameters

TNumeric
The type of numeric value to average.

Return Value

TNumeric
The average of the sequence of values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTNumeric. 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).

Exceptions

InvalidOperationExceptionsource contains no elements.
ArgumentNullExceptionsource is .

See Also