TypeBuilder.DefineEvent(String, EventAttributes, 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

事件的名稱。 name 不能包含內嵌的 null。

attributes
EventAttributes

事件的屬性。

eventtype
Type

事件的類型。

傳回

定義的事件。

例外狀況

name 的長度為零。

namenull

-或-

eventtypenull

先前使用 CreateType() 建立的類型。

適用於