次の方法で共有


StackFrame.GetMethod メソッド

フレームを実行しているメソッドを取得します。

Public Overridable Function GetMethod() As MethodBase
[C#]
public virtual MethodBase GetMethod();
[C++]
public: virtual MethodBase* GetMethod();
[JScript]
public function GetMethod() : MethodBase;

戻り値

フレームを実行しているメソッド。

使用例

[Visual Basic, C#, C++] GetMethod メソッドを使用する方法を次のコード例に示します。

 
Dim frame As New StackFrame(1, True)
Dim strace As New StackTrace(frame)            

EventLog.WriteEntry(frame.GetMethod().Name, _
                    strace.ToString(), _
                    EventLogEntryType.Warning)

[C#] 
StackFrame fr = new StackFrame(1,true);
StackTrace st = new StackTrace(fr);
EventLog.WriteEntry(fr.GetMethod().Name,
                    st.ToString(),
                    EventLogEntryType.Warning);

[C++] 
StackFrame* fr = new StackFrame(1, true);
StackTrace* st = new StackTrace(fr);
EventLog::WriteEntry(fr->GetMethod()->Name,
    st->ToString(), EventLogEntryType::Warning);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

StackFrame クラス | StackFrame メンバ | System.Diagnostics 名前空間