EnumerableExtensionsSumTSource(IEnumerableTSource, FuncTSource, UBinarySize) Method

Computes the sum of a sequence of UBinarySize values that are obtained by invoking a transform function on each element of the input sequence.

Definition

Namespace: Ookii
Assembly: Ookii.BinarySize (in Ookii.BinarySize.dll) Version: 1.2.0+20f0bdf981c7baf115c68ccab612b1a031efcb4d
C#
public static UBinarySize Sum<TSource>(
	this IEnumerable<TSource> source,
	Func<TSource, UBinarySize> selector
)

Parameters

source  IEnumerableTSource
A sequence of values to calculate the sum of.
selector  FuncTSource, UBinarySize
A transform function to apply to each element.

Type Parameters

TSource
The type of the elements of source.

Return Value

UBinarySize
The sum of the values in the sequence.

Usage Note

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

This method returns zero if source contains no elements.

Exceptions

ArgumentNullExceptionsource or selector is .
OverflowException The sum is larger than UBinarySizeMaxValue.

See Also