TypeBuilder.GetEvent(String, BindingFlags) 方法

定義

傳回具有指定名稱的事件。

public:
 override System::Reflection::EventInfo ^ GetEvent(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public override System.Reflection.EventInfo? GetEvent (string name, System.Reflection.BindingFlags bindingAttr);
public override System.Reflection.EventInfo GetEvent (string name, System.Reflection.BindingFlags bindingAttr);
override this.GetEvent : string * System.Reflection.BindingFlags -> System.Reflection.EventInfo
Public Overrides Function GetEvent (name As String, bindingAttr As BindingFlags) As EventInfo

參數

name
String

要搜尋的事件名稱。

bindingAttr
BindingFlags

限制搜尋範圍之 BindingFlags 值的位元組合。

傳回

EventInfo 物件,代表這個類型所宣告或繼承之具有指定名稱的事件;如果沒有相符的項目,則為 null

例外狀況

不會為不完整的類型實作此方法。

備註

使用 或 Assembly.GetTypeType.GetType 取類型,並在擷取的類型上使用反映。

適用於