共用方式為


Observable.FromEventPattern < TDelegate, TEventArgs > 方法 (Action < TDelegate > , Action < TDelegate >)

將符合標準 .NET 事件模式的 .NET 事件轉換為具有指定之新增處理常式和移除處理常式的可觀察序列。

Namespace:System.Reactive.Linq
裝配: System.Reactive.dll) 中的 System.Reactive (

Syntax

'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)
public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(
    Action<TDelegate> addHandler,
    Action<TDelegate> removeHandler
)
where TEventArgs : EventArgs
public:
generic<typename TDelegate, typename TEventArgs>
where TEventArgs : EventArgs
static IObservable<EventPattern<TEventArgs>^>^ FromEventPattern(
    Action<TDelegate>^ addHandler, 
    Action<TDelegate>^ removeHandler
)
static member FromEventPattern : 
        addHandler:Action<'TDelegate> * 
        removeHandler:Action<'TDelegate> -> IObservable<EventPattern<'TEventArgs>>  when 'TEventArgs : EventArgs
JScript does not support generic types and methods.

類型參數

  • TDelegate
    委派的類型。
  • TEventArgs
    事件的類型。

參數

  • addHandler
    類型:System.Action< TDelegate>
    將指定事件處理常式附加至基礎 .NET 事件的動作。
  • removeHandler
    類型:System.Action< TDelegate>
    從基礎 .NET 事件中斷連結指定事件處理常式的動作。

傳回值

類型:System.IObservable<EventPattern< TEventArgs>>
可觀察的序列,其中包含基礎 .NET 事件調用的資料表示。

另請參閱

參考

Observable 類別

FromEventPattern 多載

System.Reactive.Linq 命名空間