TypeBuilder.DefineEvent(String, EventAttributes, Type) 方法

定義

將新事件加入此類型,並指定其名稱、屬性和事件類型。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

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

attributes
EventAttributes

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

eventtype
Type

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

傳回

EventBuilder

定義的事件。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().

適用於