Share via


StackFrame.GetMethod 메서드

정의

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

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

반환

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

예제

다음 예제에서는 GetMethod 메서드를 사용하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 StackFrame 클래스입니다.

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)

설명

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

적용 대상