ObservableAsync.StatelessPublish(IObservableAsync) 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 ConnectableObservableAsync<T> StatelessPublish<T>(this IObservableAsync<T> source) - 2.
public static ConnectableObservableAsync<T> StatelessPublish<T>(this IObservableAsync<T> source, T initialValue)
1. Overload¶
public static ConnectableObservableAsync<T> StatelessPublish<T>(this IObservableAsync<T> source)
Summary: Creates a connectable observable sequence that shares a single subscription to the underlying source and does not retain any state between subscriptions.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IObservableAsync | The source sequence. |
Returns: ConnectableObservableAsync
Remarks
Use this method when you want to share a single subscription to the source among multiple observers, but do not require the observable to cache or replay any items for new subscribers. Each connection to the returned observable is independent and does not affect subsequent connections.
2. Overload¶
public static ConnectableObservableAsync<T> StatelessPublish<T>(this IObservableAsync<T> source, T initialValue)
Summary: Creates a connectable observable sequence that shares a single subscription to the underlying source and replays the most recent value to new subscribers, starting with the specified initial value.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IObservableAsync | The source sequence. |
initialValue | T | The initial value to be emitted to subscribers before any values are published by the source sequence. |
Returns: ConnectableObservableAsync
Remarks
The returned observable does not maintain any state between connections. Each connection starts with the provided initial value and only replays the most recent value published during that connection. This is useful for scenarios where late subscribers should always receive the latest value, even if they subscribe after the source has started emitting.