StackFrame.GetFileLineNumber StackFrame.GetFileLineNumber StackFrame.GetFileLineNumber StackFrame.GetFileLineNumber Method

定義

実行しているコードを格納しているファイルの行番号を取得します。Gets the line number in the file that contains the code that is executing. 通常、この情報は実行可能ファイルのデバッグ シンボルから抽出されます。This information is typically extracted from the debugging symbols for the executable.

public:
 virtual int GetFileLineNumber();
public virtual int GetFileLineNumber ();
abstract member GetFileLineNumber : unit -> int
override this.GetFileLineNumber : unit -> int
Public Overridable Function GetFileLineNumber () As Integer

戻り値

ファイルの行番号。ファイルの行番号を特定できない場合は 0 (ゼロ)。The file line number, or 0 (zero) if the file line number cannot be determined.

GetFileLineNumber メソッドの使用例を次に示します。The following example demonstrates the use of the GetFileLineNumber method. このコード例は、 StackFrameクラスに対して提供される大規模な例の一部です。This code example is part of a larger example provided for the StackFrame class.

// Display the stack frame properties.
StackFrame^ sf = st->GetFrame( i );
Console::WriteLine( " File: {0}", sf->GetFileName() );
Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() );

// Note that the column number defaults to zero
// when not initialized.
Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() );
Console::WriteLine( " Intermediate Language Offset: {0}", sf->GetILOffset().ToString() );
Console::WriteLine( " Native Offset: {0}", sf->GetNativeOffset().ToString() );

// Display the stack frame properties.
StackFrame sf = st.GetFrame(i);
Console.WriteLine(" File: {0}", sf.GetFileName());
Console.WriteLine(" Line Number: {0}", 
   sf.GetFileLineNumber());
// Note that the column number defaults to zero
// when not initialized.
Console.WriteLine(" Column Number: {0}", 
   sf.GetFileColumnNumber());
if (sf.GetILOffset() != StackFrame.OFFSET_UNKNOWN)
{
   Console.WriteLine(" Intermediate Language Offset: {0}", 
      sf.GetILOffset());
}
if (sf.GetNativeOffset() != StackFrame.OFFSET_UNKNOWN)
{
   Console.WriteLine(" Native Offset: {0}", 
      sf.GetNativeOffset());
}
' Display the stack frame properties.
Dim sf As StackFrame = st.GetFrame(i)
Console.WriteLine(" File: {0}", sf.GetFileName())
Console.WriteLine(" Line Number: {0}", _
   sf.GetFileLineNumber())
' The column number defaults to zero when not initialized.
Console.WriteLine(" Column Number: {0}", _
   sf.GetFileColumnNumber())
If sf.GetILOffset <> StackFrame.OFFSET_UNKNOWN
   Console.WriteLine(" Intermediate Language Offset: {0}", _
       sf.GetILOffset())
End If
If sf.GetNativeOffset <> StackFrame.OFFSET_UNKNOWN
  Console.WriteLine(" Native Offset: {0}", _
      sf.GetNativeOffset())
End If

適用対象