Observable.FromEventPattern(Of TDelegate, TEventArgs) Method (Action(Of TDelegate), Action(Of TDelegate))

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

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

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

returnValue = Observable.FromEventPattern(addHandler, _
	removeHandler)

Type Parameters

TDelegate

The type of delegate.

TEventArgs

The type of event.

Parameters

addHandler
Type: System.Action(Of TDelegate)
The action that attaches the given event handler to the underlying .NET event.
removeHandler
Type: System.Action(Of TDelegate)
The action that detaches the given event handler from the underlying .NET event.

Return Value

Type: System.IObservable(Of EventPattern(Of TEventArgs))
The observable sequence that contains data representations of invocations of the underlying .NET event.
Show: