)} ,ReactiveUI.Extensions.Async.Subjects.SubjectCreationOptions)} ,--0)} ,--0,ReactiveUI.Extensions.Async.Subjects.BehaviorSubjectCreationOptions)}
ObservableAsync.Publish(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> Publish<T>(this IObservableAsync<T> source) - 2.
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source, SubjectCreationOptions options) - 3.
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source, T initialValue) - 4.
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source, T initialValue, BehaviorSubjectCreationOptions options)
1. Overload¶
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source)
Summary: Returns a connectable observable sequence that shares a single subscription to the underlying asynchronous observable. Observers will receive all notifications published after they subscribe.
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 to create a hot observable that allows multiple observers to share a single subscription to the source. This is useful for scenarios where you want to avoid multiple subscriptions to the source sequence or coordinate the timing of subscriptions. The returned connectable observable is asynchronous and supports concurrent observers.
2. Overload¶
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source, SubjectCreationOptions options)
Summary: Creates a connectable observable sequence that shares a single subscription to the underlying sequence, using a subject created with the specified options.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IObservableAsync | The source sequence. |
options | [SubjectCreationOptions](# | The options used to configure the subject that will multicast the source sequence. Cannot be null. |
Returns: ConnectableObservableAsync
Remarks
The returned connectable observable does not begin emitting items until its Connect method is called. Use this method to control when the subscription to the source sequence starts and to share the subscription among multiple observers.
3. Overload¶
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source, T initialValue)
Summary: Returns a connectable observable sequence that shares a single subscription to the underlying sequence 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 emitted by the source sequence. |
Returns: ConnectableObservableAsync
Remarks
Subscribers will immediately receive the initial value upon subscription, followed by subsequent values from the source sequence. The returned connectable observable does not begin emitting values until its Connect method is called.
4. Overload¶
public static ConnectableObservableAsync<T> Publish<T>(this IObservableAsync<T> source, T initialValue, BehaviorSubjectCreationOptions options)
Summary: Creates a connectable observable sequence that shares a single subscription to the underlying sequence and starts 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 items are emitted by the source sequence. |
options | [BehaviorSubjectCreationOptions](# | The options used to configure the behavior of the underlying behavior subject. |
Returns: ConnectableObservableAsync
Remarks
The returned connectable observable will not begin emitting items from the source sequence until its Connect method is called. Subscribers will immediately receive the most recent value, starting with the specified initial value, upon subscription.