単一フレームを格納している StackTrace クラスの新しいインスタンスを初期化します。
名前空間: System.Diagnostics
アセンブリ: mscorlib (mscorlib.dll 内)
構文
'宣言
Public Sub New ( _
frame As StackFrame _
)
'使用
Dim frame As StackFrame
Dim instance As New StackTrace(frame)
public StackTrace (
StackFrame frame
)
public:
StackTrace (
StackFrame^ frame
)
public StackTrace (
StackFrame frame
)
public function StackTrace (
frame : StackFrame
)
パラメータ
- frame
StackTrace オブジェクトに格納するフレーム。
解説
フル スタック トレースのオーバーヘッドを回避する場合に、このコンストラクタを使用します。
使用例
スタック トレース情報をイベント ログ エントリに書き込むコード例を次に示します。
Dim frame As New StackFrame(1, True)
Dim strace As New StackTrace(frame)
EventLog.WriteEntry(frame.GetMethod().Name, _
strace.ToString(), _
EventLogEntryType.Warning)
StackFrame fr = new StackFrame(1,true);
StackTrace st = new StackTrace(fr);
EventLog.WriteEntry(fr.GetMethod().Name,
st.ToString(),
EventLogEntryType.Warning);
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().get_Name(), st.ToString(),
EventLogEntryType.Warning);
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0
参照
関連項目
StackTrace クラス
StackTrace メンバ
System.Diagnostics 名前空間
StackFrame クラス