<PackageReference Include="System.Reactive" Version="6.0.1-preview.1" />

Observer

public static class Observer
Provides a set of static methods for creating observers.
public static IObserver<T> AsObserver<T>(this IObserver<T> observer)

Hides the identity of an observer.

public static IObserver<T> Checked<T>(this IObserver<T> observer)

Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods. If a violation is detected, an InvalidOperationException is thrown from the offending observer method call.

public static IObserver<T> Create<T>(Action<T> onNext)

Creates an observer from the specified OnNext action.

public static IObserver<T> Create<T>(Action<T> onNext, Action<Exception> onError)

Creates an observer from the specified OnNext and OnError actions.

public static IObserver<T> Create<T>(Action<T> onNext, Action onCompleted)

Creates an observer from the specified OnNext and OnCompleted actions.

public static IObserver<T> Create<T>(Action<T> onNext, Action<Exception> onError, Action onCompleted)

Creates an observer from the specified OnNext, OnError, and OnCompleted actions.

public static IObserver<T> NotifyOn<T>(this IObserver<T> observer, IScheduler scheduler)

Schedules the invocation of observer methods on the given scheduler.

public static IObserver<T> NotifyOn<T>(this IObserver<T> observer, SynchronizationContext context)

Schedules the invocation of observer methods on the given synchronization context.

public static IObserver<T> Synchronize<T>(IObserver<T> observer)

Synchronizes access to the observer such that its callback methods cannot be called concurrently from multiple threads. This overload is useful when coordinating access to an observer. Notice reentrant observer callbacks on the same thread are still possible.

public static IObserver<T> Synchronize<T>(IObserver<T> observer, bool preventReentrancy)

Synchronizes access to the observer such that its callback methods cannot be called concurrently. This overload is useful when coordinating access to an observer. The preventReentrancy parameter configures the type of lock used for synchronization.

public static IObserver<T> Synchronize<T>(IObserver<T> observer, object gate)

Synchronizes access to the observer such that its callback methods cannot be called concurrently by multiple threads, using the specified gate object for use by a MonitorMonitor-based lock. This overload is useful when coordinating multiple observers that access shared state by synchronizing on a common gate object. Notice reentrant observer callbacks on the same thread are still possible.

public static IObserver<T> Synchronize<T>(IObserver<T> observer, AsyncLock asyncLock)

Synchronizes access to the observer such that its callback methods cannot be called concurrently, using the specified asynchronous lock to protect against concurrent and reentrant access. This overload is useful when coordinating multiple observers that access shared state by synchronizing on a common asynchronous lock.

public static Action<Notification<T>> ToNotifier<T>(this IObserver<T> observer)

Creates a notification callback from an observer.

public static IObserver<T> ToObserver<T>(this Action<Notification<T>> handler)

Creates an observer from a notification callback.

public static IObserver<T> ToObserver<T>(this IProgress<T> progress)

Converts a progress object to an observer.

public static IProgress<T> ToProgress<T>(this IObserver<T> observer)

Converts an observer to a progress object.

public static IProgress<T> ToProgress<T>(this IObserver<T> observer, IScheduler scheduler)

Converts an observer to a progress object, using the specified scheduler to invoke the progress reporting method.