VirtualTypeBuilder.EventInfoCollection.Add 方法

定义

重载

Add(EventInfo)

EventInfo 添加到集合的末尾。

Add(String, Type)

EventInfo 添加到集合的末尾。

Add(String, Type, Attribute[])

EventInfo 添加到集合的末尾。

Add(String, Type, Attribute[], MethodAttributes)

EventInfo 添加到集合的末尾。

Add(EventInfo)

EventInfo 添加到集合的末尾。

public:
 int Add(System::Reflection::EventInfo ^ value);
public int Add (System.Reflection.EventInfo value);
member this.Add : System.Reflection.EventInfo -> int
Public Function Add (value As EventInfo) As Integer

参数

value
EventInfo

要添加到集合末尾的 EventInfo

返回

Int32

已添加值处的索引。

适用于

Add(String, Type)

EventInfo 添加到集合的末尾。

public:
 int Add(System::String ^ name, Type ^ handlerType);
public:
 int Add(Platform::String ^ name, Platform::Type ^ handlerType);
public int Add (string name, Type handlerType);
member this.Add : string * Type -> int
Public Function Add (name As String, handlerType As Type) As Integer

参数

name
String

要添加的事件的名称。

handlerType
Type

此事件表示的委托的类型。

返回

Int32

已添加值处的索引。

例外

namehandlerTypenull

handlerType 不是运行时类型。

适用于

Add(String, Type, Attribute[])

EventInfo 添加到集合的末尾。

public:
 int Add(System::String ^ name, Type ^ handlerType, cli::array <Attribute ^> ^ attributes);
public:
 int Add(Platform::String ^ name, Platform::Type ^ handlerType, Platform::Array <Platform::Metadata::Attribute ^> ^ attributes);
public int Add (string name, Type handlerType, Attribute[] attributes);
member this.Add : string * Type * Attribute[] -> int
Public Function Add (name As String, handlerType As Type, attributes As Attribute()) As Integer

参数

name
String

要添加的事件的名称。

handlerType
Type

此事件表示的委托的类型。

attributes
Attribute[]

此值必须为 Public 和/或 Static

返回

Int32

已添加值处的索引。

例外

namehandlerType 中的元素 attributesnullattributes 本身可能是 null

handlerType 不是运行时类型。

适用于

Add(String, Type, Attribute[], MethodAttributes)

EventInfo 添加到集合的末尾。

public:
 int Add(System::String ^ name, Type ^ handlerType, cli::array <Attribute ^> ^ attributes, System::Reflection::MethodAttributes methodAttributes);
public int Add (string name, Type handlerType, Attribute[] attributes, System.Reflection.MethodAttributes methodAttributes);
member this.Add : string * Type * Attribute[] * System.Reflection.MethodAttributes -> int
Public Function Add (name As String, handlerType As Type, attributes As Attribute(), methodAttributes As MethodAttributes) As Integer

参数

name
String

要添加的事件的名称。

handlerType
Type

此事件表示的委托的类型。

attributes
Attribute[]

一个 Attribute 对象数组。

methodAttributes
MethodAttributes

当前支持的方法特性仅为 Public 和/或 Static

返回

Int32

已添加值处的索引。

例外

namehandlerType 中的元素 attributesnullattributes 本身可能是 null

handlerType 不是运行时类型-或-不 methodAttributes 包含 Public 或包含除和以外的设置位 Public Static ,也不能将通过参数传入的特性 attributes 应用于事件。

适用于