EnumBuilder.GetEvent(String, BindingFlags) Método

Definição

Retorna o evento com o nome especificado.

public:
 override System::Reflection::EventInfo ^ GetEvent(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo? GetEvent(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);
[<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)>]
override this.GetEvent : string * System.Reflection.BindingFlags -> System.Reflection.EventInfo
override this.GetEvent : string * System.Reflection.BindingFlags -> System.Reflection.EventInfo
Public Overrides Function GetEvent (name As String, bindingAttr As BindingFlags) As EventInfo

Parâmetros

name
String

O nome do evento a ser obtido.

bindingAttr
BindingFlags

Esse atributo de invocação. Isso deve ser um sinalizador de bit de BindingFlags : InvokeMethod, NonPublice assim por diante.

Retornos

Retorna um EventInfo objeto que representa o evento declarado ou herdado por esse tipo com o nome especificado. Se não houver correspondências, null será retornado.

Atributos

Exceções

No momento, não há suporte para esse método em tipos que não estão concluídos.

Comentários

Como solução alternativa, para recuperar o evento de um tipo concluído, recupere o tipo usando Type.GetType ou Assembly.GetType use reflexão sobre o tipo recuperado.

Aplica-se a