Aracılığıyla paylaş


StackFrame.GetMethod Yöntem

Tanım

Çerçevenin yürütülmekte olduğu yöntemi alır.

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

Döndürülenler

Çerçevenin yürütülmekte olduğu yöntem.

Öznitelikler

Örnekler

Aşağıdaki örnekte yönteminin kullanımı gösterilmektedir GetMethod . Bu kod örneği, sınıfı için StackFrame sağlanan daha büyük bir örneğin parçasıdır.

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)

Açıklamalar

Şu anda yürütülmekte olan yöntem, türetilmiş bir sınıfta çağrılsa da bir temel sınıftan devralınabilir. Bu durumda, ReflectedType tarafından GetMethod döndürülen nesnesinin MethodBase özelliği türetilmiş sınıfı değil temel sınıfı tanımlar.

Şunlara uygulanır