Share via


Observer.ToObserver<T> Method

Creates an observer from a notification callback.

Namespace:  System.Reactive
Assembly:  System.Reactive (in System.Reactive.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function ToObserver(Of T) ( _
    handler As Action(Of Notification(Of T)) _
) As IObserver(Of T)
'Usage
Dim handler As Action(Of Notification(Of T))
Dim returnValue As IObserver(Of T)

returnValue = handler.ToObserver()
public static IObserver<T> ToObserver<T>(
    this Action<Notification<T>> handler
)
[ExtensionAttribute]
public:
generic<typename T>
static IObserver<T>^ ToObserver(
    Action<Notification<T>^>^ handler
)
static member ToObserver : 
        handler:Action<Notification<'T>> -> IObserver<'T> 
JScript does not support generic types and methods.

Type Parameters

  • T
    The observer argument type.

Parameters

Return Value

Type: System.IObserver<T>
The observer object that invokes the specified handler using a notification corresponding to each message it receives.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Action<Notification<T>>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

See Also

Reference

Observer Class

System.Reactive Namespace