Observable.FromEvent < TDelegate, TEventArgs > 方法 (Action < TDelegate > , Action < TDelegate >)
將 .NET 事件轉換為可觀察的序列。
Namespace:System.Reactive.Linq
裝配: System.Reactive.dll) 中的 System.Reactive (
Syntax
'Declaration
Public Shared Function FromEvent(Of TDelegate, TEventArgs) ( _
addHandler As Action(Of TDelegate), _
removeHandler As Action(Of TDelegate) _
) As IObservable(Of TEventArgs)
'Usage
Dim addHandler As Action(Of TDelegate)
Dim removeHandler As Action(Of TDelegate)
Dim returnValue As IObservable(Of TEventArgs)
returnValue = Observable.FromEvent(addHandler, _
removeHandler)
public static IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(
Action<TDelegate> addHandler,
Action<TDelegate> removeHandler
)
public:
generic<typename TDelegate, typename TEventArgs>
static IObservable<TEventArgs>^ FromEvent(
Action<TDelegate>^ addHandler,
Action<TDelegate>^ removeHandler
)
static member FromEvent :
addHandler:Action<'TDelegate> *
removeHandler:Action<'TDelegate> -> IObservable<'TEventArgs>
JScript does not support generic types and methods.
類型參數
- TDelegate
委派的類型。
- TEventArgs
事件的類型。
參數
- addHandler
類型:System.Action< TDelegate>
將指定事件處理常式附加至基礎 .NET 事件的動作。
- removeHandler
類型:System.Action< TDelegate>
從基礎 .NET 事件中斷連結指定事件處理常式的動作。
傳回值
類型:System.IObservable< TEventArgs>
可觀察的序列,其中包含基礎 .NET 事件調用的資料表示。