WindowsRuntimeMarshal.AddEventHandler<T> 方法

定义

向 Windows 运行时事件添加指定的事件处理程序。

此 API 支持产品基础结构,不能在代码中直接使用。

public:
generic <typename T>
 static void AddEventHandler(Func<T, System::Runtime::InteropServices::WindowsRuntime::EventRegistrationToken> ^ addMethod, Action<System::Runtime::InteropServices::WindowsRuntime::EventRegistrationToken> ^ removeMethod, T handler);
[System.Security.SecurityCritical]
public static void AddEventHandler<T> (Func<T,System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> addMethod, Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod, T handler);
public static void AddEventHandler<T> (Func<T,System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> addMethod, Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod, T handler);
[<System.Security.SecurityCritical>]
static member AddEventHandler : Func<'T, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * 'T -> unit
static member AddEventHandler : Func<'T, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * 'T -> unit
Public Shared Sub AddEventHandler(Of T) (addMethod As Func(Of T, EventRegistrationToken), removeMethod As Action(Of EventRegistrationToken), handler As T)

类型参数

T

代表事件处理程序委托的类型。

参数

addMethod
Func<T,EventRegistrationToken>

委托,它表示向 Windows 运行时事件添加事件处理程序的方法。

removeMethod
Action<EventRegistrationToken>

委托,表示从 Windows 运行时事件中移除事件处理程序的方法。

handler
T

表示添加的事件处理程序的委托。

属性

例外

addMethodnull

removeMethodnull

适用于