Skip to content

,System.IObserver{--0})}

ObservableExtensions.SubscribeSafe(IObservable, IObserver) method

Defined in

Type: ObservableExtensions Namespace: System Assembly: System.Reactive.dll

Applies to

netstandard2.0

Attributes: [EditorBrowsable(EditorBrowsableState.2)]

public static IDisposable SubscribeSafe<T>(this IObservable<T> source, IObserver<T> observer)

Summary: Subscribes to the specified source, re-routing synchronous exceptions during invocation of the Subscribe method to the observer's OnError channel. This method is typically used when writing query operators.

Type parameters

NameDescription
TThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableObservable sequence to subscribe to.
observerIObserverObserver that will be passed to the observable sequence, and that will be used for exception propagation.

Returns: IDisposable -- IDisposable object used to unsubscribe from the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or observer is null.