Share via


Observable.FromEventPattern Method (Action<EventHandler>, Action<EventHandler>)

Converts a .NET event, conforming to the standard .NET event pattern, to an observable sequence with a specified add handler and remove handler.

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

Syntax

'Declaration
Public Shared Function FromEventPattern ( _
    addHandler As Action(Of EventHandler), _
    removeHandler As Action(Of EventHandler) _
) As IObservable(Of EventPattern(Of EventArgs))
'Usage
Dim addHandler As Action(Of EventHandler)
Dim removeHandler As Action(Of EventHandler)
Dim returnValue As IObservable(Of EventPattern(Of EventArgs))

returnValue = Observable.FromEventPattern(addHandler, _
    removeHandler)
public static IObservable<EventPattern<EventArgs>> FromEventPattern(
    Action<EventHandler> addHandler,
    Action<EventHandler> removeHandler
)
public:
static IObservable<EventPattern<EventArgs^>^>^ FromEventPattern(
    Action<EventHandler^>^ addHandler, 
    Action<EventHandler^>^ removeHandler
)
static member FromEventPattern : 
        addHandler:Action<EventHandler> * 
        removeHandler:Action<EventHandler> -> IObservable<EventPattern<EventArgs>> 
public static function FromEventPattern(
    addHandler : Action<EventHandler>, 
    removeHandler : Action<EventHandler>
) : IObservable<EventPattern<EventArgs>>

Parameters

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

Return Value

Type: System.IObservable<EventPattern<EventArgs>>
The observable sequence that contains data representations of invocations of the underlying .NET event.

See Also

Reference

Observable Class

FromEventPattern Overload

System.Reactive.Linq Namespace