Skip to content

})} )}

Observer.ToObserver(Action>) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IObserver<T> ToObserver<T>(this Action<Notification<T>> handler)
  • 2. public static IObserver<T> ToObserver<T>(this IProgress<T> progress)

1. Overload

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

Summary: Creates an observer from a notification callback.

Type parameters

NameDescription
TThe type of the elements received by the observer.

Parameters

NameTypeDescription
handlerAction>Action that handles a notification.

Returns: IObserver -- The observer object that invokes the specified handler using a notification corresponding to each message it receives.

Exceptions

TypeCondition
System.ArgumentNullExceptionhandler is null.

2. Overload

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

Summary: Converts a progress object to an observer.

Type parameters

NameDescription
TThe type of the progress objects received by the progress reporter.

Parameters

NameTypeDescription
progressIProgressThe progress object to convert.

Returns: IObserver -- Observer whose OnNext messages correspond to the progress object's Report messages.

Exceptions

TypeCondition
System.ArgumentNullExceptionprogress is null.