TypeBuilder.DefineEvent(String, EventAttributes, Type) TypeBuilder.DefineEvent(String, EventAttributes, Type) TypeBuilder.DefineEvent(String, EventAttributes, Type) TypeBuilder.DefineEvent(String, EventAttributes, Type) Method

定义

将新事件添加到该类型,使用给定的名称、属性和事件类型。Adds a new event to the type, with the given name, attributes and event type.

public:
 System::Reflection::Emit::EventBuilder ^ DefineEvent(System::String ^ name, System::Reflection::EventAttributes attributes, Type ^ eventtype);
public System.Reflection.Emit.EventBuilder DefineEvent (string name, System.Reflection.EventAttributes attributes, Type eventtype);
member this.DefineEvent : string * System.Reflection.EventAttributes * Type -> System.Reflection.Emit.EventBuilder
Public Function DefineEvent (name As String, attributes As EventAttributes, eventtype As Type) As EventBuilder

参数

name
String String String String

事件的名称。The name of the event. name 不能包含嵌入的 null。name cannot contain embedded nulls.

attributes
EventAttributes EventAttributes EventAttributes EventAttributes

事件的属性。The attributes of the event.

eventtype
Type Type Type Type

事件的类型。The type of the event.

返回

已定义的事件。The defined event.

异常

name 的长度为零。The length of name is zero.

namenullname is null.

- 或 --or- eventtypenulleventtype is null.

该类型是以前使用 CreateType() 创建的。The type was previously created using CreateType().

适用于