AsyncEnumerableExtensionsSumAsync(IAsyncEnumerableNullableUBinarySize, CancellationToken) Method

Asynchronously computes the sum of a sequence of nullable UBinarySize values.

Definition

Namespace: Ookii
Assembly: Ookii.BinarySize.Async (in Ookii.BinarySize.Async.dll) Version: 1.2.0+20f0bdf981c7baf115c68ccab612b1a031efcb4d
C#
public static ValueTask<UBinarySize?> SumAsync(
	this IAsyncEnumerable<UBinarySize?> source,
	CancellationToken cancellationToken = default
)

Parameters

source  IAsyncEnumerableNullableUBinarySize
A sequence of nullable UBinarySize values to calculate the sum of.
cancellationToken  CancellationToken  (Optional)
The optional cancellation token to be used for canceling the sequence at any time.

Return Value

ValueTaskNullableUBinarySize
A task that represents the asynchronous operation. The result of the task is 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 IAsyncEnumerableNullableUBinarySize. 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

Items in source that are are excluded from the computation of the sum. This method returns zero if source contains no elements or all elements are .

Exceptions

ArgumentNullExceptionsource is .
OverflowException The sum is larger than UBinarySizeMaxValue.

See Also