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

适用于