TypeBuilder.GetEvent(String, BindingFlags) 方法

定義

傳回具有指定名稱的事件。Returns the event with the specified name.

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

要搜尋的事件名稱。The name of the event to search for.

bindingAttr
BindingFlags

限制搜尋範圍之 BindingFlags 值的位元組合。A bitwise combination of BindingFlags values that limits the search.

傳回

EventInfo

EventInfo 物件,代表這個類型所宣告或繼承之具有指定名稱的事件;如果沒有相符的項目,則為 nullAn EventInfo object representing the event declared or inherited by this type with the specified name, or null if there are no matches.

例外狀況

不會為不完整的類型實作此方法。This method is not implemented for incomplete types.

備註

使用或抓取型 Type.GetTypeAssembly.GetType ,然後在抓取的型別上使用反映。Retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.

適用於