Skip to content

,System.Func{--0,--1})} ,System.Func{--0,--1},System.Func{--1,ReactiveUI.Extensions.Async.Subjects.ISubjectAsync{--0}})}

ObservableAsync.GroupBy(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 IObservableAsync<GroupedAsyncObservable<TKey, TValue>> GroupBy<TValue, TKey>(this IObservableAsync<TValue> source, Func<TValue, TKey> keySelector) where TKey : notnull
  • 2. public static IObservableAsync<GroupedAsyncObservable<TKey, TValue>> GroupBy<TValue, TKey>(this IObservableAsync<TValue> source, Func<TValue, TKey> keySelector, Func<TKey, ISubjectAsync<TValue>> groupSubjectSelector) where TKey : notnull

1. Overload

public static IObservableAsync<GroupedAsyncObservable<TKey, TValue>> GroupBy<TValue, TKey>(this IObservableAsync<TValue> source, Func<TValue, TKey> keySelector) where TKey : notnull

View source

Summary: Groups the elements of an asynchronous observable sequence according to a specified key selector function.

Type parameters

NameDescription
TValueThe type of elements in the source sequence.
TKeyThe type of the key returned by the key selector function. Must be non-nullable.

Parameters

NameTypeDescription
source[IObservableAsync](#The source observable sequence.
keySelectorFuncA function to extract the key for each element in the source sequence.

Returns: IObservableAsync> -- An asynchronous observable sequence of grouped observables, each containing elements that share a common key.

Remarks

Each group in the resulting sequence corresponds to a unique key produced by the key selector. The groups are emitted as soon as their first element is encountered in the source sequence. The returned grouped observables can be subscribed to independently.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if keySelector is null.

2. Overload

public static IObservableAsync<GroupedAsyncObservable<TKey, TValue>> GroupBy<TValue, TKey>(this IObservableAsync<TValue> source, Func<TValue, TKey> keySelector, Func<TKey, ISubjectAsync<TValue>> groupSubjectSelector) where TKey : notnull

View source

Summary: Groups the elements of an asynchronous observable sequence according to a specified key selector function and returns an observable sequence of grouped observables.

Type parameters

NameDescription
TValueThe type of elements in the source sequence.
TKeyThe type of the key returned by the key selector function. Must be non-null.

Parameters

NameTypeDescription
source[IObservableAsync](#The source observable sequence.
keySelectorFuncA function to extract the key for each element in the source sequence.
groupSubjectSelectorFunc>A function that provides a subject for each group, given its key. Used to control how elements are published within each group.

Returns: IObservableAsync> -- An asynchronous observable sequence containing grouped observables, each representing a collection of elements that share a common key.

Remarks

Each group in the resulting sequence is represented by a GroupedAsyncObservable, which exposes the group's key and an observable sequence of its elements. The groupSubjectSelector parameter allows customization of the subject used for each group, which can affect how elements are buffered or multicast within the group.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if keySelector is null.