This documentation is archived and is not being maintained.

OpCodes.Throw Field

Throws the exception object currently on the evaluation stack.

[Visual Basic]
Public Shared ReadOnly Throw As OpCode
[C#]
public static readonly OpCode Throw;
[C++]
public: static OpCode Throw;
[JScript]
public static var Throw : OpCode;

Remarks

The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

Format Assembly Format Description
7A throw Throws an exception.

The stack transitional behavior, in sequential order, is:

  1. An object reference (to an exception) is pushed onto the stack.
  2. The object reference is popped from the stack and the exception thrown.

The throw instruction throws the exception object (type O) currently on the stack.

NullReferenceException is thrown if the object reference is a null reference.

The following Emit constructor overload can use the throw opcode:

  • ILGenerator.Emit(OpCode)

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

OpCodes Class | OpCodes Members | System.Reflection.Emit Namespace

Show: