OpCodes Class

Provides field representations of the Microsoft Intermediate Language (MSIL) instructions for emission by the ILGenerator class members (such as Emit).

System.Object
  System.Reflection.Emit.OpCodes

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

[ComVisibleAttribute(true)]
public class OpCodes

The OpCodes type exposes the following members.

  NameDescription
Public methodSupported in .NET for Windows Store appsEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported in .NET for Windows Store appsFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported in .NET for Windows Store appsGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported in .NET for Windows Store appsMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberSupported in .NET for Windows Store appsTakesSingleByteArgumentReturns true or false if the supplied opcode takes a single byte argument.
Public methodSupported in .NET for Windows Store appsToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public fieldStatic memberSupported in .NET for Windows Store appsAddAdds two values and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsAdd_OvfAdds two integers, performs an overflow check, and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsAdd_Ovf_UnAdds two unsigned integer values, performs an overflow check, and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsAndComputes the bitwise AND of two values and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsArglistReturns an unmanaged pointer to the argument list of the current method.
Public fieldStatic memberSupported in .NET for Windows Store appsBeqTransfers control to a target instruction if two values are equal.
Public fieldStatic memberSupported in .NET for Windows Store appsBeq_STransfers control to a target instruction (short form) if two values are equal.
Public fieldStatic memberSupported in .NET for Windows Store appsBgeTransfers control to a target instruction if the first value is greater than or equal to the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBge_STransfers control to a target instruction (short form) if the first value is greater than or equal to the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBge_UnTransfers control to a target instruction if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBge_Un_STransfers control to a target instruction (short form) if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBgtTransfers control to a target instruction if the first value is greater than the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBgt_STransfers control to a target instruction (short form) if the first value is greater than the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBgt_UnTransfers control to a target instruction if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBgt_Un_STransfers control to a target instruction (short form) if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBleTransfers control to a target instruction if the first value is less than or equal to the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBle_STransfers control to a target instruction (short form) if the first value is less than or equal to the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBle_UnTransfers control to a target instruction if the first value is less than or equal to the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBle_Un_STransfers control to a target instruction (short form) if the first value is less than or equal to the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBltTransfers control to a target instruction if the first value is less than the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBlt_STransfers control to a target instruction (short form) if the first value is less than the second value.
Public fieldStatic memberSupported in .NET for Windows Store appsBlt_UnTransfers control to a target instruction if the first value is less than the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBlt_Un_STransfers control to a target instruction (short form) if the first value is less than the second value, when comparing unsigned integer values or unordered float values.
Public fieldStatic memberSupported in .NET for Windows Store appsBne_UnTransfers control to a target instruction when two unsigned integer values or unordered float values are not equal.
Public fieldStatic memberSupported in .NET for Windows Store appsBne_Un_STransfers control to a target instruction (short form) when two unsigned integer values or unordered float values are not equal.
Public fieldStatic memberSupported in .NET for Windows Store appsBoxConverts a value type to an object reference (type O).
Public fieldStatic memberSupported in .NET for Windows Store appsBrUnconditionally transfers control to a target instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsBr_SUnconditionally transfers control to a target instruction (short form).
Public fieldStatic memberSupported in .NET for Windows Store appsBreakSignals the Common Language Infrastructure (CLI) to inform the debugger that a break point has been tripped.
Public fieldStatic memberSupported in .NET for Windows Store appsBrfalseTransfers control to a target instruction if value is false, a null reference (Nothing in Visual Basic), or zero.
Public fieldStatic memberSupported in .NET for Windows Store appsBrfalse_STransfers control to a target instruction if value is false, a null reference, or zero.
Public fieldStatic memberSupported in .NET for Windows Store appsBrtrueTransfers control to a target instruction if value is true, not null, or non-zero.
Public fieldStatic memberSupported in .NET for Windows Store appsBrtrue_STransfers control to a target instruction (short form) if value is true, not null, or non-zero.
Public fieldStatic memberSupported in .NET for Windows Store appsCallCalls the method indicated by the passed method descriptor.
Public fieldStatic memberSupported in .NET for Windows Store appsCalliCalls the method indicated on the evaluation stack (as a pointer to an entry point) with arguments described by a calling convention.
Public fieldStatic memberSupported in .NET for Windows Store appsCallvirtCalls a late-bound method on an object, pushing the return value onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsCastclassAttempts to cast an object passed by reference to the specified class.
Public fieldStatic memberSupported in .NET for Windows Store appsCeqCompares two values. If they are equal, the integer value 1 (int32) is pushed onto the evaluation stack; otherwise 0 (int32) is pushed onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsCgtCompares two values. If the first value is greater than the second, the integer value 1 (int32) is pushed onto the evaluation stack; otherwise 0 (int32) is pushed onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsCgt_UnCompares two unsigned or unordered values. If the first value is greater than the second, the integer value 1 (int32) is pushed onto the evaluation stack; otherwise 0 (int32) is pushed onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsCkfiniteThrows ArithmeticException if value is not a finite number.
Public fieldStatic memberSupported in .NET for Windows Store appsCltCompares two values. If the first value is less than the second, the integer value 1 (int32) is pushed onto the evaluation stack; otherwise 0 (int32) is pushed onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsClt_UnCompares the unsigned or unordered values value1 and value2. If value1 is less than value2, then the integer value 1 (int32) is pushed onto the evaluation stack; otherwise 0 (int32) is pushed onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsConstrainedConstrains the type on which a virtual method call is made.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_IConverts the value on top of the evaluation stack to native int.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_I1Converts the value on top of the evaluation stack to int8, then extends (pads) it to int32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_I2Converts the value on top of the evaluation stack to int16, then extends (pads) it to int32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_I4Converts the value on top of the evaluation stack to int32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_I8Converts the value on top of the evaluation stack to int64.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_IConverts the signed value on top of the evaluation stack to signed native int, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I_UnConverts the unsigned value on top of the evaluation stack to signed native int, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I1Converts the signed value on top of the evaluation stack to signed int8 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I1_UnConverts the unsigned value on top of the evaluation stack to signed int8 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I2Converts the signed value on top of the evaluation stack to signed int16 and extending it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I2_UnConverts the unsigned value on top of the evaluation stack to signed int16 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I4Converts the signed value on top of the evaluation stack to signed int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I4_UnConverts the unsigned value on top of the evaluation stack to signed int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I8Converts the signed value on top of the evaluation stack to signed int64, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_I8_UnConverts the unsigned value on top of the evaluation stack to signed int64, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_UConverts the signed value on top of the evaluation stack to unsigned native int, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U_UnConverts the unsigned value on top of the evaluation stack to unsigned native int, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U1Converts the signed value on top of the evaluation stack to unsigned int8 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U1_UnConverts the unsigned value on top of the evaluation stack to unsigned int8 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U2Converts the signed value on top of the evaluation stack to unsigned int16 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U2_UnConverts the unsigned value on top of the evaluation stack to unsigned int16 and extends it to int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U4Converts the signed value on top of the evaluation stack to unsigned int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U4_UnConverts the unsigned value on top of the evaluation stack to unsigned int32, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U8Converts the signed value on top of the evaluation stack to unsigned int64, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_Ovf_U8_UnConverts the unsigned value on top of the evaluation stack to unsigned int64, throwing OverflowException on overflow.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_R_UnConverts the unsigned integer value on top of the evaluation stack to float32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_R4Converts the value on top of the evaluation stack to float32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_R8Converts the value on top of the evaluation stack to float64.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_UConverts the value on top of the evaluation stack to unsigned native int, and extends it to native int.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_U1Converts the value on top of the evaluation stack to unsigned int8, and extends it to int32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_U2Converts the value on top of the evaluation stack to unsigned int16, and extends it to int32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_U4Converts the value on top of the evaluation stack to unsigned int32, and extends it to int32.
Public fieldStatic memberSupported in .NET for Windows Store appsConv_U8Converts the value on top of the evaluation stack to unsigned int64, and extends it to int64.
Public fieldStatic memberSupported in .NET for Windows Store appsCpblkCopies a specified number bytes from a source address to a destination address.
Public fieldStatic memberSupported in .NET for Windows Store appsCpobjCopies the value type located at the address of an object (type &, * or native int) to the address of the destination object (type &, * or native int).
Public fieldStatic memberSupported in .NET for Windows Store appsDivDivides two values and pushes the result as a floating-point (type F) or quotient (type int32) onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsDiv_UnDivides two unsigned integer values and pushes the result (int32) onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsDupCopies the current topmost value on the evaluation stack, and then pushes the copy onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsEndfilterTransfers control from the filter clause of an exception back to the Common Language Infrastructure (CLI) exception handler.
Public fieldStatic memberSupported in .NET for Windows Store appsEndfinallyTransfers control from the fault or finally clause of an exception block back to the Common Language Infrastructure (CLI) exception handler.
Public fieldStatic memberSupported in .NET for Windows Store appsInitblkInitializes a specified block of memory at a specific address to a given size and initial value.
Public fieldStatic memberSupported in .NET for Windows Store appsInitobjInitializes each field of the value type at a specified address to a null reference or a 0 of the appropriate primitive type.
Public fieldStatic memberSupported in .NET for Windows Store appsIsinstTests whether an object reference (type O) is an instance of a particular class.
Public fieldStatic memberSupported in .NET for Windows Store appsJmpExits current method and jumps to specified method.
Public fieldStatic memberSupported in .NET for Windows Store appsLdargLoads an argument (referenced by a specified index value) onto the stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdarg_0Loads the argument at index 0 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdarg_1Loads the argument at index 1 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdarg_2Loads the argument at index 2 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdarg_3Loads the argument at index 3 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdarg_SLoads the argument (referenced by a specified short form index) onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdargaLoad an argument address onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdarga_SLoad an argument address, in short form, onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4Pushes a supplied value of type int32 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_0Pushes the integer value of 0 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_1Pushes the integer value of 1 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_2Pushes the integer value of 2 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_3Pushes the integer value of 3 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_4Pushes the integer value of 4 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_5Pushes the integer value of 5 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_6Pushes the integer value of 6 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_7Pushes the integer value of 7 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_8Pushes the integer value of 8 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_M1Pushes the integer value of -1 onto the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I4_SPushes the supplied int8 value onto the evaluation stack as an int32, short form.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_I8Pushes a supplied value of type int64 onto the evaluation stack as an int64.
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_R4Pushes a supplied value of type float32 onto the evaluation stack as type F (float).
Public fieldStatic memberSupported in .NET for Windows Store appsLdc_R8Pushes a supplied value of type float64 onto the evaluation stack as type F (float).
Public fieldStatic memberSupported in .NET for Windows Store appsLdelemLoads the element at a specified array index onto the top of the evaluation stack as the type specified in the instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_ILoads the element with type native int at a specified array index onto the top of the evaluation stack as a native int.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_I1Loads the element with type int8 at a specified array index onto the top of the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_I2Loads the element with type int16 at a specified array index onto the top of the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_I4Loads the element with type int32 at a specified array index onto the top of the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_I8Loads the element with type int64 at a specified array index onto the top of the evaluation stack as an int64.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_R4Loads the element with type float32 at a specified array index onto the top of the evaluation stack as type F (float).
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_R8Loads the element with type float64 at a specified array index onto the top of the evaluation stack as type F (float).
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_RefLoads the element containing an object reference at a specified array index onto the top of the evaluation stack as type O (object reference).
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_U1Loads the element with type unsigned int8 at a specified array index onto the top of the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_U2Loads the element with type unsigned int16 at a specified array index onto the top of the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelem_U4Loads the element with type unsigned int32 at a specified array index onto the top of the evaluation stack as an int32.
Public fieldStatic memberSupported in .NET for Windows Store appsLdelemaLoads the address of the array element at a specified array index onto the top of the evaluation stack as type & (managed pointer).
Public fieldStatic memberSupported in .NET for Windows Store appsLdfldFinds the value of a field in the object whose reference is currently on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdfldaFinds the address of a field in the object whose reference is currently on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdftnPushes an unmanaged pointer (type native int) to the native code implementing a specific method onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_ILoads a value of type native int as a native int onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_I1Loads a value of type int8 as an int32 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_I2Loads a value of type int16 as an int32 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_I4Loads a value of type int32 as an int32 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_I8Loads a value of type int64 as an int64 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_R4Loads a value of type float32 as a type F (float) onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_R8Loads a value of type float64 as a type F (float) onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_RefLoads an object reference as a type O (object reference) onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_U1Loads a value of type unsigned int8 as an int32 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_U2Loads a value of type unsigned int16 as an int32 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdind_U4Loads a value of type unsigned int32 as an int32 onto the evaluation stack indirectly.
Public fieldStatic memberSupported in .NET for Windows Store appsLdlenPushes the number of elements of a zero-based, one-dimensional array onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdlocLoads the local variable at a specific index onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdloc_0Loads the local variable at index 0 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdloc_1Loads the local variable at index 1 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdloc_2Loads the local variable at index 2 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdloc_3Loads the local variable at index 3 onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdloc_SLoads the local variable at a specific index onto the evaluation stack, short form.
Public fieldStatic memberSupported in .NET for Windows Store appsLdlocaLoads the address of the local variable at a specific index onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdloca_SLoads the address of the local variable at a specific index onto the evaluation stack, short form.
Public fieldStatic memberSupported in .NET for Windows Store appsLdnullPushes a null reference (type O) onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdobjCopies the value type object pointed to by an address to the top of the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdsfldPushes the value of a static field onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdsfldaPushes the address of a static field onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdstrPushes a new object reference to a string literal stored in the metadata.
Public fieldStatic memberSupported in .NET for Windows Store appsLdtokenConverts a metadata token to its runtime representation, pushing it onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLdvirtftnPushes an unmanaged pointer (type native int) to the native code implementing a particular virtual method associated with a specified object onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsLeaveExits a protected region of code, unconditionally transferring control to a specific target instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsLeave_SExits a protected region of code, unconditionally transferring control to a target instruction (short form).
Public fieldStatic memberSupported in .NET for Windows Store appsLocallocAllocates a certain number of bytes from the local dynamic memory pool and pushes the address (a transient pointer, type *) of the first allocated byte onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsMkrefanyPushes a typed reference to an instance of a specific type onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsMulMultiplies two values and pushes the result on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsMul_OvfMultiplies two integer values, performs an overflow check, and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsMul_Ovf_UnMultiplies two unsigned integer values, performs an overflow check, and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsNegNegates a value and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsNewarrPushes an object reference to a new zero-based, one-dimensional array whose elements are of a specific type onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsNewobjCreates a new object or a new instance of a value type, pushing an object reference (type O) onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsNopFills space if opcodes are patched. No meaningful operation is performed although a processing cycle can be consumed.
Public fieldStatic memberSupported in .NET for Windows Store appsNotComputes the bitwise complement of the integer value on top of the stack and pushes the result onto the evaluation stack as the same type.
Public fieldStatic memberSupported in .NET for Windows Store appsOrCompute the bitwise complement of the two integer values on top of the stack and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsPopRemoves the value currently on top of the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix1Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix2Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix3Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix4Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix5Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix6Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefix7Infrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsPrefixrefInfrastructure. This is a reserved instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsReadonlySpecifies that the subsequent array address operation performs no type check at run time, and that it returns a managed pointer whose mutability is restricted.
Public fieldStatic memberSupported in .NET for Windows Store appsRefanytypeRetrieves the type token embedded in a typed reference.
Public fieldStatic memberSupported in .NET for Windows Store appsRefanyvalRetrieves the address (type &) embedded in a typed reference.
Public fieldStatic memberSupported in .NET for Windows Store appsRemDivides two values and pushes the remainder onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsRem_UnDivides two unsigned values and pushes the remainder onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsRetReturns from the current method, pushing a return value (if present) from the callee's evaluation stack onto the caller's evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsRethrowRethrows the current exception.
Public fieldStatic memberSupported in .NET for Windows Store appsShlShifts an integer value to the left (in zeroes) by a specified number of bits, pushing the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsShrShifts an integer value (in sign) to the right by a specified number of bits, pushing the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsShr_UnShifts an unsigned integer value (in zeroes) to the right by a specified number of bits, pushing the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsSizeofPushes the size, in bytes, of a supplied value type onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStargStores the value on top of the evaluation stack in the argument slot at a specified index.
Public fieldStatic memberSupported in .NET for Windows Store appsStarg_SStores the value on top of the evaluation stack in the argument slot at a specified index, short form.
Public fieldStatic memberSupported in .NET for Windows Store appsStelemReplaces the array element at a given index with the value on the evaluation stack, whose type is specified in the instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_IReplaces the array element at a given index with the native int value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_I1Replaces the array element at a given index with the int8 value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_I2Replaces the array element at a given index with the int16 value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_I4Replaces the array element at a given index with the int32 value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_I8Replaces the array element at a given index with the int64 value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_R4Replaces the array element at a given index with the float32 value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_R8Replaces the array element at a given index with the float64 value on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStelem_RefReplaces the array element at a given index with the object ref value (type O) on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsStfldReplaces the value stored in the field of an object reference or pointer with a new value.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_IStores a value of type native int at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_I1Stores a value of type int8 at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_I2Stores a value of type int16 at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_I4Stores a value of type int32 at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_I8Stores a value of type int64 at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_R4Stores a value of type float32 at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_R8Stores a value of type float64 at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStind_RefStores a object reference value at a supplied address.
Public fieldStatic memberSupported in .NET for Windows Store appsStlocPops the current value from the top of the evaluation stack and stores it in a the local variable list at a specified index.
Public fieldStatic memberSupported in .NET for Windows Store appsStloc_0Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 0.
Public fieldStatic memberSupported in .NET for Windows Store appsStloc_1Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 1.
Public fieldStatic memberSupported in .NET for Windows Store appsStloc_2Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 2.
Public fieldStatic memberSupported in .NET for Windows Store appsStloc_3Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 3.
Public fieldStatic memberSupported in .NET for Windows Store appsStloc_SPops the current value from the top of the evaluation stack and stores it in a the local variable list at index (short form).
Public fieldStatic memberSupported in .NET for Windows Store appsStobjCopies a value of a specified type from the evaluation stack into a supplied memory address.
Public fieldStatic memberSupported in .NET for Windows Store appsStsfldReplaces the value of a static field with a value from the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsSubSubtracts one value from another and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsSub_OvfSubtracts one integer value from another, performs an overflow check, and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsSub_Ovf_UnSubtracts one unsigned integer value from another, performs an overflow check, and pushes the result onto the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsSwitchImplements a jump table.
Public fieldStatic memberSupported in .NET for Windows Store appsTailcallPerforms a postfixed method call instruction such that the current method's stack frame is removed before the actual call instruction is executed.
Public fieldStatic memberSupported in .NET for Windows Store appsThrowThrows the exception object currently on the evaluation stack.
Public fieldStatic memberSupported in .NET for Windows Store appsUnalignedIndicates that an address currently atop the evaluation stack might not be aligned to the natural size of the immediately following ldind, stind, ldfld, stfld, ldobj, stobj, initblk, or cpblk instruction.
Public fieldStatic memberSupported in .NET for Windows Store appsUnboxConverts the boxed representation of a value type to its unboxed form.
Public fieldStatic memberSupported in .NET for Windows Store appsUnbox_AnyConverts the boxed representation of a type specified in the instruction to its unboxed form.
Public fieldStatic memberSupported in .NET for Windows Store appsVolatileSpecifies that an address currently atop the evaluation stack might be volatile, and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed.
Public fieldStatic memberSupported in .NET for Windows Store appsXorComputes the bitwise XOR of the top two values on the evaluation stack, pushing the result onto the evaluation stack.
Top

For a detailed description of the member opcodes, see the Common Language Infrastructure (CLI) documentation, especially "Partition III: CIL Instruction Set" and "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

The following example demonstrates the construction of a dynamic method using ILGenerator to emit OpCodes into a MethodBuilder.


using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

class EmitWriteLineDemo {

   public static Type CreateDynamicType() {       
       Type[] ctorParams = new Type[] {typeof(int),
				   typeof(int)};
 	
       AppDomain myDomain = Thread.GetDomain();
       AssemblyName myAsmName = new AssemblyName();
       myAsmName.Name = "MyDynamicAssembly";

       AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly(
				      myAsmName, 
				      AssemblyBuilderAccess.Run);

       ModuleBuilder pointModule = myAsmBuilder.DefineDynamicModule("PointModule",
								    "Point.dll");

       TypeBuilder pointTypeBld = pointModule.DefineType("Point",
					              TypeAttributes.Public);

       FieldBuilder xField = pointTypeBld.DefineField("x", typeof(int),
                                                      FieldAttributes.Public);
       FieldBuilder yField = pointTypeBld.DefineField("y", typeof(int), 
                                                      FieldAttributes.Public);


       Type objType = Type.GetType("System.Object"); 
       ConstructorInfo objCtor = objType.GetConstructor(new Type[0]);

       ConstructorBuilder pointCtor = pointTypeBld.DefineConstructor(
 				                   MethodAttributes.Public,
				                   CallingConventions.Standard,
				                   ctorParams);
       ILGenerator ctorIL = pointCtor.GetILGenerator();


       // First, you build the constructor.
       ctorIL.Emit(OpCodes.Ldarg_0);
       ctorIL.Emit(OpCodes.Call, objCtor);
       ctorIL.Emit(OpCodes.Ldarg_0);
       ctorIL.Emit(OpCodes.Ldarg_1);
       ctorIL.Emit(OpCodes.Stfld, xField); 
       ctorIL.Emit(OpCodes.Ldarg_0);
       ctorIL.Emit(OpCodes.Ldarg_2);
       ctorIL.Emit(OpCodes.Stfld, yField); 
       ctorIL.Emit(OpCodes.Ret); 

       //  Now, you'll build a method to output some information on the 
       // inside your dynamic class. This method will have the following 
       // definition in C#: 
	//  public void WritePoint()

       MethodBuilder writeStrMthd = pointTypeBld.DefineMethod(
        		                     "WritePoint", 
				             MethodAttributes.Public,
                                             typeof(void), 
                                             null);


       ILGenerator writeStrIL = writeStrMthd.GetILGenerator();

       // The below ILGenerator created demonstrates a few ways to create 
       // string output through STDIN.  

       // ILGenerator.EmitWriteLine(string) will generate a ldstr and a  
       // call to WriteLine for you.

       writeStrIL.EmitWriteLine("The value of this current instance is:");

       // Here, you will do the hard work yourself. First, you need to create 
       // the string we will be passing and obtain the correct WriteLine overload 
       // for said string. In the below case, you are substituting in two values, 
       // so the chosen overload is Console.WriteLine(string, object, object).

       String inStr = "({0}, {1})";
       Type[] wlParams = new Type[] {typeof(string),
				     typeof(object),
				     typeof(object)};

       // We need the MethodInfo to pass into EmitCall later.

       MethodInfo writeLineMI = typeof(Console).GetMethod(
					        "WriteLine",
						wlParams);

       // Push the string with the substitutions onto the stack. 
       // This is the first argument for WriteLine - the string one. 

       writeStrIL.Emit(OpCodes.Ldstr, inStr);

       // Since the second argument is an object, and it corresponds to 
       // to the substitution for the value of our integer field, you  
       // need to box that field to an object. First, push a reference 
       // to the current instance, and then push the value stored in 
       // field 'x'. We need the reference to the current instance (stored 
       // in local argument index 0) so Ldfld can load from the correct 
       // instance (this one).

       writeStrIL.Emit(OpCodes.Ldarg_0);
       writeStrIL.Emit(OpCodes.Ldfld, xField);

       // Now, we execute the box opcode, which pops the value of field 'x', 
       // returning a reference to the integer value boxed as an object.

       writeStrIL.Emit(OpCodes.Box, typeof(int));

       // Atop the stack, you'll find our string inStr, followed by a reference 
       // to the boxed value of 'x'. Now, you need to likewise box field 'y'.

       writeStrIL.Emit(OpCodes.Ldarg_0);
       writeStrIL.Emit(OpCodes.Ldfld, yField);
       writeStrIL.Emit(OpCodes.Box, typeof(int));

       // Now, you have all of the arguments for your call to 
       // Console.WriteLine(string, object, object) atop the stack: 
       // the string InStr, a reference to the boxed value of 'x', and 
       // a reference to the boxed value of 'y'. 

       // Call Console.WriteLine(string, object, object) with EmitCall.

       writeStrIL.EmitCall(OpCodes.Call, writeLineMI, null);

       // Lastly, EmitWriteLine can also output the value of a field 
       // using the overload EmitWriteLine(FieldInfo).

       writeStrIL.EmitWriteLine("The value of 'x' is:");
       writeStrIL.EmitWriteLine(xField);
       writeStrIL.EmitWriteLine("The value of 'y' is:");
       writeStrIL.EmitWriteLine(yField);

       // Since we return no value (void), the the ret opcode will not 
       // return the top stack value.

       writeStrIL.Emit(OpCodes.Ret);

       return pointTypeBld.CreateType();

   }

   public static void Main() {

      object[] ctorParams = new object[2];

      Console.Write("Enter a integer value for X: "); 
      string myX = Console.ReadLine();
      Console.Write("Enter a integer value for Y: "); 
      string myY = Console.ReadLine();

      Console.WriteLine("---");

      ctorParams[0] = Convert.ToInt32(myX);
      ctorParams[1] = Convert.ToInt32(myY);

      Type ptType = CreateDynamicType();

      object ptInstance = Activator.CreateInstance(ptType, ctorParams);
      ptType.InvokeMember("WritePoint",
			  BindingFlags.InvokeMethod,
			  null,
			  ptInstance,
			  new object[0]);
   }
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft