Observable.FromEvent Method (Action<Action>, Action<Action>)

Converts a .NET event to an observable sequence.

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

Syntax

'Declaration
Public Shared Function FromEvent ( _
    addHandler As Action(Of Action), _
    removeHandler As Action(Of Action) _
) As IObservable(Of Unit)
'Usage
Dim addHandler As Action(Of Action)
Dim removeHandler As Action(Of Action)
Dim returnValue As IObservable(Of Unit)

returnValue = Observable.FromEvent(addHandler, _
    removeHandler)
public static IObservable<Unit> FromEvent(
    Action<Action> addHandler,
    Action<Action> removeHandler
)
public:
static IObservable<Unit>^ FromEvent(
    Action<Action^>^ addHandler, 
    Action<Action^>^ removeHandler
)
static member FromEvent : 
        addHandler:Action<Action> * 
        removeHandler:Action<Action> -> IObservable<Unit> 
public static function FromEvent(
    addHandler : Action<Action>, 
    removeHandler : Action<Action>
) : IObservable<Unit>

Parameters

  • addHandler
    Type: System.Action<Action>
    Action that attaches the given event handler to the underlying .NET event.
  • removeHandler
    Type: System.Action<Action>
    Action that detaches the given event handler from the underlying .NET event.

Return Value

Type: System.IObservable<Unit>
Observable sequence that contains data representations of invocations of the underlying .NET event.

See Also

Reference

Observable Class

FromEvent Overload

System.Reactive.Linq Namespace