StackFrame.GetMethod Método

Definição

Obtém o método no qual o quadro está em execução.Gets the method in which the frame is executing.

public:
 System::Reflection::MethodBase ^ GetMethod();
public:
 virtual System::Reflection::MethodBase ^ GetMethod();
public System.Reflection.MethodBase GetMethod ();
public virtual System.Reflection.MethodBase? GetMethod ();
public virtual System.Reflection.MethodBase GetMethod ();
member this.GetMethod : unit -> System.Reflection.MethodBase
abstract member GetMethod : unit -> System.Reflection.MethodBase
override this.GetMethod : unit -> System.Reflection.MethodBase
Public Function GetMethod () As MethodBase
Public Overridable Function GetMethod () As MethodBase

Retornos

MethodBase

O método no qual o quadro está em execução.The method in which the frame is executing.

Exemplos

O exemplo a seguir demonstra o uso do método GetMethod.The following example demonstrates the use of the GetMethod method. Este exemplo de código faz parte de um exemplo maior fornecido para a StackFrame classe.This code example is part of a larger example provided for the StackFrame class.

StackFrame^ fr = gcnew StackFrame( 1,true );
StackTrace^ st = gcnew StackTrace( fr );
EventLog::WriteEntry( fr->GetMethod()->Name, st->ToString(), EventLogEntryType::Warning );
StackFrame fr = new StackFrame(1,true);
StackTrace st = new StackTrace(fr);
EventLog.WriteEntry(fr.GetMethod().Name,
                    st.ToString(),
                    EventLogEntryType.Warning);
Dim frame As New StackFrame(1, True)
Dim strace As New StackTrace(frame)            

EventLog.WriteEntry(frame.GetMethod().Name, _
                    strace.ToString(), _
                    EventLogEntryType.Warning)

Comentários

O método que está em execução no momento pode ser herdado de uma classe base, embora seja chamado em uma classe derivada.The method that is currently executing may be inherited from a base class, although it is called in a derived class. Nesse caso, a ReflectedType Propriedade do MethodBase objeto retornado pelo GetMethod identifica a classe base, não a classe derivada.In this case, the ReflectedType property of the MethodBase object that is returned by GetMethod identifies the base class, not the derived class.

Aplica-se a