,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
Summary: Groups the elements of an asynchronous observable sequence according to a specified key selector function.
Type parameters
| Name | Description |
|---|---|
TValue | The type of elements in the source sequence. |
TKey | The type of the key returned by the key selector function. Must be non-nullable. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IObservableAsync | The source observable sequence. |
keySelector | Func | A function to extract the key for each element in the source sequence. |
Returns: IObservableAsync
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
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown 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
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
| Name | Description |
|---|---|
TValue | The type of elements in the source sequence. |
TKey | The type of the key returned by the key selector function. Must be non-null. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IObservableAsync | The source observable sequence. |
keySelector | Func | A function to extract the key for each element in the source sequence. |
groupSubjectSelector | Func | A function that provides a subject for each group, given its key. Used to control how elements are published within each group. |
Returns: IObservableAsync
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
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if keySelector is null. |