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