Condividi tramite


StackFrame.GetMethod Metodo

Definizione

Ottiene il metodo in cui viene eseguito il frame.

public:
 System::Reflection::MethodBase ^ GetMethod();
public:
 virtual System::Reflection::MethodBase ^ GetMethod();
public System.Reflection.MethodBase GetMethod();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Metadata for the method might be incomplete or removed. Consider using DiagnosticMethodInfo.Create instead")]
public virtual System.Reflection.MethodBase? GetMethod();
public virtual System.Reflection.MethodBase? GetMethod();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Metadata for the method might be incomplete or removed")]
public virtual System.Reflection.MethodBase? GetMethod();
public virtual System.Reflection.MethodBase GetMethod();
member this.GetMethod : unit -> System.Reflection.MethodBase
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Metadata for the method might be incomplete or removed. Consider using DiagnosticMethodInfo.Create instead")>]
abstract member GetMethod : unit -> System.Reflection.MethodBase
override this.GetMethod : unit -> System.Reflection.MethodBase
abstract member GetMethod : unit -> System.Reflection.MethodBase
override this.GetMethod : unit -> System.Reflection.MethodBase
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Metadata for the method might be incomplete or removed")>]
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

Restituisce

Metodo in cui viene eseguito il frame.

Attributi

Esempio

Nell'esempio seguente viene illustrato l'uso del metodo GetMethod. Questo esempio di codice fa parte di un esempio più ampio fornito per la StackFrame classe .

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)

Commenti

Il metodo attualmente in esecuzione può essere ereditato da una classe di base, anche se viene chiamato in una classe derivata. In questo caso, la ReflectedType proprietà dell'oggetto MethodBase restituito da GetMethod identifica la classe base, non la classe derivata.

Si applica a