다음을 통해 공유


StackFrame.GetMethod 메서드

정의

프레임이 실행되는 메서드를 가져옵니다.

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

반환

프레임이 실행되는 메서드입니다.

특성

예제

다음 예제에서는 GetMethod 메서드를 사용하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 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)

설명

현재 실행 중인 메서드는 파생 클래스에서 호출되지만 기본 클래스에서 상속될 수 있습니다. 이 경우 ReflectedType 반환 GetMethod 되는 개체의 MethodBase 속성은 파생 클래스가 아닌 기본 클래스를 식별합니다.

적용 대상