StackFrame.GetILOffset StackFrame.GetILOffset StackFrame.GetILOffset StackFrame.GetILOffset Method

定義

実行中のメソッドの MSIL (Microsoft Intermediate Language) コードの先頭からのオフセットを取得します。Gets the offset from the start of the Microsoft intermediate language (MSIL) code for the method that is executing. このオフセットは Just-In-Time (JIT) コンパイラがデバッグするコードを生成しているかどうかに依存する近似値になることがあります。This offset might be an approximation depending on whether or not the just-in-time (JIT) compiler is generating debugging code. このデバッグ情報の生成は、DebuggableAttribute により制御されます。The generation of this debugging information is controlled by the DebuggableAttribute.

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

戻り値

実行中のメソッドのための MSIL コードの先頭からのオフセット。The offset from the start of the MSIL code for the method that is executing.

GetILOffset メソッドの使用例を次に示します。The following example demonstrates the use of the GetILOffset 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

適用対象

こちらもご覧ください