Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

OpCodes.Conv_Ovf_I2 Field

Converts the signed value on top of the evaluation stack to signed int16 and extending it to int32, throwing OverflowException on overflow.

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)

public static readonly OpCode Conv_Ovf_I2
public static final OpCode Conv_Ovf_I2
public static final var Conv_Ovf_I2 : OpCode

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

B5

conv.ovf.i2

Convert to an int16 (on the stack as int32) and throw an exception on overflow.

The stack transitional behavior, in sequential order, is:

  1. value is pushed onto the stack.

  2. value is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown.

  3. If the conversion is successful, the resulting value is pushed onto the stack.

The conv.ovf.i2 opcode converts the value on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown.

Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to int32 when they are loaded onto the evaluation stack (unless conv.ovf.i or conv.ovf.u are used, in which case the result is also natural int).

OverflowException is thrown if the result can not be represented in the result type.

The following Emit method overload can use the conv.ovf.i2 opcode:

  • ILGenerator.Emit(OpCode)

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft