Breyta

Deila með


StackFrame.GetILOffset Method

Definition

Gets the offset from the start of the Microsoft intermediate language (MSIL) code for the method that is executing. This offset might be an approximation depending on whether or not the just-in-time (JIT) compiler is generating debugging code. The generation of this debugging information is controlled by the DebuggableAttribute.

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

Returns

The offset from the start of the MSIL code for the method that is executing.

Examples

The following example demonstrates the use of the GetILOffset method. 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

Applies to

See also