StackFrame.ToString メソッド
アセンブリ: mscorlib (mscorlib.dll 内)
 構文
構文Dim instance As StackFrame Dim returnValue As String returnValue = instance.ToString
読み取り可能な形式を返します。
 使用例
使用例ToString メソッドを使用する方法を次のコード例に示します。
Public Sub InternalMethod() Try Dim nestedClass As New ClassLevel2 nestedClass.Level2Method() Catch e As Exception Console.WriteLine(" InternalMethod exception handler") ' Build a stack trace from one frame, skipping the ' current frame and using the next frame. By default, ' file and line information are not displayed. Dim st As New StackTrace(New StackFrame(1)) Console.WriteLine(" Stack trace for next level frame: {0}", _ st.ToString()) Console.WriteLine(" Stack frame for next level: ") Console.WriteLine(" {0}", st.GetFrame(0).ToString()) Console.WriteLine(" Line Number: {0}", _ st.GetFrame(0).GetFileLineNumber().ToString()) Console.WriteLine() Console.WriteLine(" ... throwing exception to next level ...") Console.WriteLine("-------------------------------------------------") Console.WriteLine() Throw e End Try End Sub 'InternalMethod
public void InternalMethod() { try { ClassLevel2 nestedClass = new ClassLevel2(); nestedClass.Level2Method(); } catch (Exception e) { Console.WriteLine(" InternalMethod exception handler"); // Build a stack trace from one frame, skipping the // current frame and using the next frame. By // default, file and line information are not displayed. StackTrace st = new StackTrace(new StackFrame(1)); Console.WriteLine(" Stack trace for next level frame: {0}", st.ToString()); Console.WriteLine(" Stack frame for next level: "); Console.WriteLine(" {0}", st.GetFrame(0).ToString()); Console.WriteLine(" Line Number: {0}", st.GetFrame(0).GetFileLineNumber().ToString()); Console.WriteLine(); Console.WriteLine(" ... throwing exception to next level ..."); Console.WriteLine("-------------------------------------------------\n"); throw e; } }
void InternalMethod() { try { ClassLevel2^ nestedClass = gcnew ClassLevel2; nestedClass->Level2Method(); } catch ( Exception^ e ) { Console::WriteLine( " InternalMethod exception handler" ); // Build a stack trace from one frame, skipping the // current frame and using the next frame. By // default, file and line information are not displayed. StackTrace^ st = gcnew StackTrace( gcnew StackFrame( 1 ) ); Console::WriteLine( " Stack trace for next level frame: {0}", st->ToString() ); Console::WriteLine( " Stack frame for next level: " ); Console::WriteLine( " {0}", st->GetFrame( 0 )->ToString() ); Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() ); Console::WriteLine(); Console::WriteLine( " ... throwing exception to next level ..." ); Console::WriteLine( "-------------------------------------------------\n" ); throw e; } }
public void InternalMethod() throws System.Exception { try { ClassLevel2 nestedClass = new ClassLevel2(); nestedClass.Level2Method(); } catch (System.Exception e) { Console.WriteLine(" InternalMethod exception handler"); // Build a stack trace from one frame, skipping the // current frame and using the next frame. By // default, file and line information are not displayed. StackTrace st = new StackTrace(new StackFrame(1)); Console.WriteLine(" Stack trace for next level frame: {0}", st.ToString()); Console.WriteLine(" Stack frame for next level: "); Console.WriteLine(" {0}", st.GetFrame(0).ToString()); Console.WriteLine(" Line Number: {0}", Convert.ToString(st.GetFrame(0).GetFileLineNumber())); Console.WriteLine(); Console.WriteLine(" ... throwing exception to next level..."); Console.WriteLine("-------------------------------------------" + "------\n"); throw e; } } //InternalMethod
 .NET Framework のセキュリティ
.NET Framework のセキュリティ プラットフォーム
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
 バージョン情報
バージョン情報 参照
参照- StackFrame.ToString メソッドのページへのリンク

 
                             
                    


