Sdílet prostřednictvím


StackFrame.GetMethod Metoda

Definice

Získá metodu, ve které se rámeček spouští.

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

Návraty

Metoda, ve které se rámec spouští.

Atributy

Příklady

Následující příklad ukazuje použití GetMethod metody. Tento příklad kódu je součástí většího příkladu uvedeného pro třídu StackFrame.

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)

Poznámky

Metoda, která se právě spouští, může být zděděna ze základní třídy, ačkoli je volána v odvozené třídě. V tomto případě vlastnost objektuMethodBase, ReflectedType který je vrácen GetMethod identifikuje základní třídu, nikoli odvozenou třídu.

Platí pro