Skip to content

,System.Func{--0,System.Boolean})} ,System.Func{--0,System.Boolean},System.Threading.CancellationToken)} )} ,System.Threading.CancellationToken)}

ObservableAsync.LongCountAsync(IObservableAsync, Func?) method

Defined in

Type: ObservableAsync Namespace: ReactiveUI.Extensions.Async Assembly: ReactiveUI.Extensions.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this, Func<T, bool>? predicate)
  • 2. public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this, Func<T, bool>? predicate, CancellationToken cancellationToken)
  • 3. public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this)
  • 4. public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this, CancellationToken cancellationToken)

1. Overload

public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this, Func<T, bool>? predicate)

View source

Summary: Asynchronously returns the number of elements in the sequence that satisfy an optional predicate.

Type parameters

NameDescription
TThe type of elements in the source sequence.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
predicateFunc?A function to test each element for a condition. If null, all elements are counted.

Returns: ValueTask -- A task that represents the asynchronous operation. The task result contains the number of elements that satisfy the predicate, or the total number of elements if the predicate is null.

2. Overload

public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this, Func<T, bool>? predicate, CancellationToken cancellationToken)

Summary: Asynchronously returns the number of elements in the sequence that satisfy an optional predicate.

Type parameters

NameDescription
TThe type of elements in the source sequence.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
predicateFunc?A function to test each element for a condition. If null, all elements are counted.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the asynchronous operation.

Returns: ValueTask -- A task that represents the asynchronous operation. The task result contains the number of elements that satisfy the predicate, or the total number of elements if the predicate is null.

3. Overload

public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this)

View source

Summary: Asynchronously returns the total number of elements in the sequence as a 64-bit integer.

Type parameters

NameDescription
TThe type of elements in the source sequence.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.

Returns: ValueTask -- A value task representing the asynchronous operation. The result contains the number of elements in the sequence as a 64-bit integer.

4. Overload

public static ValueTask<long> LongCountAsync<T>(this IObservableAsync<T> @this, CancellationToken cancellationToken)

View source

Summary: Asynchronously returns the total number of elements in the sequence as a 64-bit integer.

Type parameters

NameDescription
TThe type of elements in the source sequence.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the asynchronous operation.

Returns: ValueTask -- A value task representing the asynchronous operation. The result contains the number of elements in the sequence as a 64-bit integer.