,System.Reactive.Subjects.ISubject{--0,--1})} ,System.Func},System.Func{System.IObservable{--1},System.IObservable{--2}})}
Observable.Multicast(IObservable, ISubject) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IConnectableObservable<TResult> Multicast<TSource, TResult>(this IObservable<TSource> source, ISubject<TSource, TResult> subject) - 2.
public static IObservable<TResult> Multicast<TSource, TIntermediate, TResult>(this IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector)
1. Overload¶
public static IConnectableObservable<TResult> Multicast<TSource, TResult>(this IObservable<TSource> source, ISubject<TSource, TResult> subject)
Summary: Multicasts the source sequence notifications through the specified subject to the resulting connectable observable. Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
TResult | The type of the elements in the result sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence whose elements will be pushed into the specified subject. |
subject | [ISubject | Subject to push source elements into. |
Returns: IConnectableObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or subject is null. |
2. Overload¶
public static IObservable<TResult> Multicast<TSource, TIntermediate, TResult>(this IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector)
Summary: Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
TIntermediate | The type of the elements produced by the intermediate subject. |
TResult | The type of the elements in the result sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence which will be multicasted in the specified selector function. |
subjectSelector | Func | Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function. |
selector | Func | Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or subjectSelector or selector is null. |