SubjectAsync.CreateReplayLatest() method¶
Defined in
Type: SubjectAsync
Namespace: ReactiveUI.Extensions.Async.Subjects
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 ISubjectAsync<T> CreateReplayLatest<T>() - 2.
public static ISubjectAsync<T> CreateReplayLatest<T>(ReplayLatestSubjectCreationOptions? options)
1. Overload¶
public static ISubjectAsync<T> CreateReplayLatest<T>()
Summary: Creates a new asynchronous subject that replays only the most recent value to new subscribers.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements processed by the subject. |
Returns: ISubjectAsync
Remarks
The returned subject will only retain the most recent value published. When a new subscriber subscribes, it immediately receives the latest value, if any, followed by subsequent values. This is useful for scenarios where only the most recent state is relevant to new observers.
2. Overload¶
public static ISubjectAsync<T> CreateReplayLatest<T>(ReplayLatestSubjectCreationOptions? options)
Summary: Creates a new asynchronous subject that replays the latest value to new subscribers, with configuration options for publishing behavior and statefulness.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements processed by the subject. |
Parameters
| Name | Type | Description |
|---|---|---|
options | [ReplayLatestSubjectCreationOptions?](# | The options that specify the publishing mode and whether the subject maintains state. Cannot be null. |
Returns: ISubjectAsync
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown if the combination of options specified in the options parameter is not supported. |