OpCodes 類別

定義

提供Microsoft中介語言(MSIL)指令的場域表示,供ILGenerator類別成員(如Emit(OpCode))發射。

public ref class OpCodes
public class OpCodes
[System.Runtime.InteropServices.ComVisible(true)]
public class OpCodes
type OpCodes = class
[<System.Runtime.InteropServices.ComVisible(true)>]
type OpCodes = class
Public Class OpCodes
繼承
OpCodes
屬性

範例

以下範例示範了將 發射ILGeneratorOpCodesMethodBuilder的動態方法的構造。


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 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]);
   }
}

Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit

 _

Class EmitWriteLineDemo
   
   
   Public Shared Function CreateDynamicType() As Type

      Dim ctorParams() As Type = {GetType(Integer), GetType(Integer)}
      
      Dim myDomain As AppDomain = Thread.GetDomain()
      Dim myAsmName As New AssemblyName()
      myAsmName.Name = "MyDynamicAssembly"
      
      Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly(myAsmName, AssemblyBuilderAccess.RunAndSave)
      
      Dim pointModule As ModuleBuilder = myAsmBuilder.DefineDynamicModule("PointModule", "Point.dll")
      
      Dim pointTypeBld As TypeBuilder = pointModule.DefineType("Point", _
                                   TypeAttributes.Public)
      
      Dim xField As FieldBuilder = pointTypeBld.DefineField("x", _
                                GetType(Integer), _
                                FieldAttributes.Public)
      Dim yField As FieldBuilder = pointTypeBld.DefineField("y", _
                                GetType(Integer), _
                                FieldAttributes.Public)
      
      
      Dim objType As Type = Type.GetType("System.Object")
      Dim objCtor As ConstructorInfo = objType.GetConstructor(New Type(){})
      
      Dim pointCtor As ConstructorBuilder = pointTypeBld.DefineConstructor( _
                             MethodAttributes.Public, _
                             CallingConventions.Standard, _
                             ctorParams)
      Dim ctorIL As ILGenerator = 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 Sub WritePoint() 

      Dim writeStrMthd As MethodBuilder = pointTypeBld.DefineMethod("WritePoint", _
                                    MethodAttributes.Public, _
                                    Nothing, Nothing)
      
      Dim writeStrIL As ILGenerator = 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).

      Dim inStr As [String] = "({0}, {1})"
      Dim wlParams() As Type = {GetType(String), GetType(Object), GetType(Object)}
      
      ' We need the MethodInfo to pass into EmitCall later.

      Dim writeLineMI As MethodInfo = GetType(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, GetType(Integer))
      
      ' 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, GetType(Integer))
      
      ' 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, Nothing)
      
      ' 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 ret opcode will not
      ' return the top stack value.

      writeStrIL.Emit(OpCodes.Ret)
      
      Return pointTypeBld.CreateType()

   End Function 'CreateDynamicType
    
   
   Public Shared Sub Main()
      
      Dim ctorParams(1) As Object
      
      Console.Write("Enter a integer value for X: ")
      Dim myX As String = Console.ReadLine()
      Console.Write("Enter a integer value for Y: ")
      Dim myY As String = Console.ReadLine()
      
      Console.WriteLine("---")
      
      ctorParams(0) = Convert.ToInt32(myX)
      ctorParams(1) = Convert.ToInt32(myY)
      
      Dim ptType As Type = CreateDynamicType()

      Dim ptInstance As Object = Activator.CreateInstance(ptType, ctorParams)

      ptType.InvokeMember("WritePoint", _
              BindingFlags.InvokeMethod, _
              Nothing, ptInstance, Nothing)

   End Sub

End Class

備註

關於成員操作碼的詳細說明,請參閱通用語言基礎架構(CLI)文件,特別是「分割區 III:CIL 指令集」與「分割區 II:元資料定義與語意」。 欲了解更多資訊,請參閱 ECMA 335 通用語言基礎架構(CLI)。

欄位

名稱 Description
Add

相加兩個值,並將結果推送到評估堆疊中。

Add_Ovf

加入兩個整數,執行溢位檢查,並將結果推入評估堆疊。

Add_Ovf_Un

加入兩個無符號整數值,執行溢位檢查,並將結果推送到評估堆疊中。

And

計算兩個值的逐位元與,並將結果推送到評估堆疊中。

Arglist

回傳一個未管理的指標,指向目前方法的參數清單。

Beq

當兩個值相等時,會將控制權轉移給目標指令。

Beq_S

若兩個值相等,則會將控制權轉移給目標指令(簡稱)。

Bge

若第一個值大於或等於第二個值,則將控制權轉移給目標指令。

Bge_S

若第一個值大於或等於第二個值,則會將控制權轉移到目標指令(簡稱)。

Bge_Un

若第一個值大於第二個值,則在比較無符號整數值或無序浮點數值時,會將控制權轉移給目標指令。

Bge_Un_S

當第一個值大於第二個值時,當比較無符號整數值或無序浮點數值時,會將控制權轉移到目標指令(簡稱)。

Bgt

若第一個值大於第二個值,則將控制權轉移給目標指令。

Bgt_S

若第一個值大於第二個值,則將控制權轉移到目標指令(簡稱)。

Bgt_Un

若第一個值大於第二個值,則在比較無符號整數值或無序浮點數值時,會將控制權轉移給目標指令。

Bgt_Un_S

當第一個值大於第二個值時,當比較無符號整數值或無序浮點數值時,會將控制權轉移到目標指令(簡稱)。

Ble

若第一個值小於或等於第二個值,則將控制權轉移給目標指令。

Ble_S

若第一個值小於或等於第二個值,則將控制權轉移給目標指令(簡寫)。

Ble_Un

若第一個值小於或等於第二個值,則在比較無號整數值或無序浮點數值時,會將控制權轉移到目標指令。

Ble_Un_S

若第一個值小於或等於第二個值,則在比較無符號整數值或無序浮點數值時,將控制權轉移到目標指令(簡稱)。

Blt

若第一個值小於第二個值,則將控制權轉移給目標指令。

Blt_S

若第一個值小於第二個值,則將控制權轉移給目標指令(簡稱)。

Blt_Un

若第一個值小於第二個值,則在比較無號整數值或無序浮點數值時,會將控制權轉移到目標指令。

Blt_Un_S

當第一個值小於第二個值時,將控制權轉移到目標指令(簡稱),當比較無符號整數值或無序浮點數值時。

Bne_Un

當兩個無符號整數值或無序浮點數值不相等時,傳輸控制指令至目標指令。

Bne_Un_S

當兩個無符號整數值或無序浮點數值不相等時,傳輸控制權到目標指令(簡寫)。

Box

將值型態轉換為物件參考(型別 O)。

Br

無條件將控制權轉移給目標指令。

Br_S

無條件將控制權轉移給目標指令(簡短形式)。

Break

向通用語言基礎架構(CLI)發出訊號,通知除錯器中斷點已被觸發。

Brfalse

valuefalse、空參考(Nothing在Visual Basic中)或為零,則將控制權轉移至目標指令。

Brfalse_S

value 為 、 、 false為 、 為零 或為零,則將控制權轉移至目標指令。

Brtrue

valuetrue、 非空指令或非零,則將控制權轉移至目標指令。

Brtrue_S

valuetrue、 非空或非零,則將控制權轉移至目標指令(簡短形式)。

Call

呼叫由傳遞的方法描述符所指示的方法。

Calli

呼叫評估堆疊上標示的方法(作為指向入口點的指標),並以呼叫慣例描述參數。

Callvirt

呼叫物件的晚期綁定方法,將回傳值推送到評估堆疊。

Castclass

嘗試透過指定類別的引用來拋射物件。

Ceq

比較兩個價值。 若兩者相等,整數值 1 (int32) 會被推入評估堆疊;否則 0(int32) 會被推入評估堆疊。

Cgt

比較兩個價值。 若第一個值大於第二個,則將整數值 1 (int32) 推入評估堆疊;否則 0(int32) 會被推入評估堆疊。

Cgt_Un

比較兩個無符號或無序值。 若第一個值大於第二個,則將整數值 1 (int32) 推入評估堆疊;否則 0(int32) 會被推入評估堆疊。

Ckfinite

擲出數 ArithmeticException 值不是有限數。

Clt

比較兩個價值。 若第一個值小於第二個,則將整數值 1 (int32) 推入評估堆疊;否則 0(int32) 會被推入評估堆疊。

Clt_Un

比較無號或無序值 value1value2。 若 value1value2於 ,則整數值 1 (int32) 被推入評估堆疊;否則 0int32() 被推入評估堆疊。

Constrained

限制虛擬方法呼叫所依據的類型。

Conv_I

將評估堆疊 native int頂端的值轉換為 。

Conv_I1

將評估堆疊 int8頂端的值轉換為 ,然後擴展(填充)為 int32

Conv_I2

將評估堆疊 int16頂端的值轉換為 ,然後擴展(填充)為 int32

Conv_I4

將評估堆疊 int32頂端的值轉換為 。

Conv_I8

將評估堆疊 int64頂端的值轉換為 。

Conv_Ovf_I

將評估堆疊頂端的有符號值轉換為有符號 native int,並 OverflowException 啟動溢位。

Conv_Ovf_I_Un

將評估堆疊頂端的無號值轉換為有符號 native int值,並 OverflowException 啟動溢位。

Conv_Ovf_I1

將評估堆疊頂端的有號值轉換為有符號 int8 值,並擴展為 int32,並觸發 OverflowException 溢位。

Conv_Ovf_I1_Un

將評估堆疊頂端的無號值轉換為有符號 int8 值,並擴展為 int32,觸發 OverflowException 溢位。

Conv_Ovf_I2

將評估堆疊頂端的有號值轉換為有符號 int16 ,並擴展為 int32,並 OverflowException 觸發溢位。

Conv_Ovf_I2_Un

將評估堆疊頂端的無號值轉換為有符號 int16 值,並擴展為 int32,觸發 OverflowException 溢位。

Conv_Ovf_I4

將評估堆疊頂端的有符號值轉換為有符號 int32,並 OverflowException 啟動溢位。

Conv_Ovf_I4_Un

將評估堆疊頂端的無號值轉換為有符號 int32值,並 OverflowException 啟動溢位。

Conv_Ovf_I8

將評估堆疊頂端的有符號值轉換為有符號 int64,並 OverflowException 啟動溢位。

Conv_Ovf_I8_Un

將評估堆疊頂端的無號值轉換為有符號 int64值,並 OverflowException 啟動溢位。

Conv_Ovf_U

將評估堆疊 unsigned native int頂端的有符號值轉換為 ,並 OverflowException 觸發溢位。

Conv_Ovf_U_Un

將評估堆疊 unsigned native int頂端的無號值轉換為 ,並 OverflowException 觸發溢位。

Conv_Ovf_U1

將評估堆疊 unsigned int8 頂端的有符號值轉換為,並擴展為 int32,並 OverflowException 觸發溢位。

Conv_Ovf_U1_Un

將評估堆疊 unsigned int8 頂端的無號值轉換為,並擴展為 int32,並 OverflowException 觸發溢位。

Conv_Ovf_U2

將評估堆疊 unsigned int16 頂端的有符號值轉換為,並擴展為 int32,並 OverflowException 觸發溢位。

Conv_Ovf_U2_Un

將評估堆疊 unsigned int16 頂端的無號值轉換為,並擴展為 int32,並 OverflowException 觸發溢位。

Conv_Ovf_U4

將評估堆疊 unsigned int32頂端的有符號值轉換為 ,並 OverflowException 觸發溢位。

Conv_Ovf_U4_Un

將評估堆疊 unsigned int32頂端的無號值轉換為 ,並 OverflowException 觸發溢位。

Conv_Ovf_U8

將評估堆疊 unsigned int64頂端的有符號值轉換為 ,並 OverflowException 觸發溢位。

Conv_Ovf_U8_Un

將評估堆疊 unsigned int64頂端的無號值轉換為 ,並 OverflowException 觸發溢位。

Conv_R_Un

將評估堆疊 float32上方的無符號整數值轉換為 。

Conv_R4

將評估堆疊 float32頂端的值轉換為 。

Conv_R8

將評估堆疊 float64頂端的值轉換為 。

Conv_U

將評估堆疊 unsigned native int頂端的值轉換為 ,並擴展為 native int

Conv_U1

將評估堆疊 unsigned int8頂端的值轉換為 ,並擴展為 int32

Conv_U2

將評估堆疊 unsigned int16頂端的值轉換為 ,並擴展為 int32

Conv_U4

將評估堆疊 unsigned int32頂端的值轉換為 ,並擴展為 int32

Conv_U8

將評估堆疊 unsigned int64頂端的值轉換為 ,並擴展為 int64

Cpblk

將指定的數字位元組從來源位址複製到目的位址。

Cpobj

將位於物件位址的值類型(類型 &native int)複製到目的物件的位址(類型 &native int)。

Div

除以兩個值,並將結果以浮點數(型別 F)或商數(型別 int32)形式推入評估堆疊。

Div_Un

除以兩個無符號整數值,並將結果int32()推入評估堆疊。

Dup

複製評估堆疊上目前最頂端的值,然後將該副本推送到評估堆疊。

Endfilter

將例外子句的控制 filter 權回傳回通用語言基礎設施(CLI)例外處理器。

Endfinally

將例外 fault 區塊的 OR finally 子句控制權轉移回 Common Language Infrastructure(CLI)例外處理程序。

Initblk

在特定位址初始化指定記憶體區塊,並設定給定大小與初始值。

Initobj

將指定位址的每個值欄位初始化為空參考或適當原始型別的 0。

Isinst

測試物件參考(型別 O)是否為特定類別的實例。

Jmp

退出目前的方法並跳到指定的方法。

Ldarg

將一個參數(由指定的索引值參考)載入堆疊。

Ldarg_0

將索引為 0 的參數載入評估堆疊。

Ldarg_1

將索引 1 的參數載入評估堆疊。

Ldarg_2

將索引 2 的參數載入評估堆疊。

Ldarg_3

將索引 3 的參數載入評估堆疊。

Ldarg_S

將參數(由指定的短形式索引參考)載入到評估堆疊中。

Ldarga

將參數位址載入評估堆疊。

Ldarga_S

將一個簡短形式的參數位址載入評估堆疊。

Ldc_I4

將提供的值 int32 型態推送到評估堆疊中。int32

Ldc_I4_0

將整數值 0 推入評估堆疊中,作為 int32

Ldc_I4_1

將整數值 1 推入評估堆疊中,作為 int32

Ldc_I4_2

將整數值 2 推入評估堆疊中,作為 int32

Ldc_I4_3

將整數值 3 推入評估堆疊中,作為 int32

Ldc_I4_4

將整數值 4 推入評估堆疊中,作為 int32

Ldc_I4_5

將整數值 5 推入評估堆疊中,作為 int32

Ldc_I4_6

將整數值 6 推入評估堆疊中,作為 int32

Ldc_I4_7

將整數值 7 推入評估堆疊中,作為 int32

Ldc_I4_8

將整數值 8 推入評估堆疊中,作為 int32

Ldc_I4_M1

將 -1 的整數值推入評估堆疊中,作為 int32

Ldc_I4_S

將所提供的 int8 值以簡短形式推送到評估堆疊 int32中。

Ldc_I8

將提供的值 int64 型態推送到評估堆疊中。int64

Ldc_R4

將提供的型別 float32 值推入評估堆疊,作為型態 F (float)。

Ldc_R8

將提供的型別 float64 值推入評估堆疊,作為型態 F (float)。

Ldelem

將指定陣列索引的元素載入到指令中指定的類型,載入到評估堆疊頂端。

Ldelem_I

將類型 native int 為指定陣列索引的元素載入到評估堆疊頂端,作為 native int

Ldelem_I1

將類型 int8 在指定陣列索引的元素載入到評估堆疊頂端,作為 int32

Ldelem_I2

將類型 int16 在指定陣列索引的元素載入到評估堆疊頂端,作為 int32

Ldelem_I4

將類型 int32 在指定陣列索引的元素載入到評估堆疊頂端,作為 int32

Ldelem_I8

將類型 int64 在指定陣列索引的元素載入到評估堆疊頂端,作為 int64

Ldelem_R4

將指定陣列索引為型別 float32 的元素載入到評估堆頂,作為型別 F (float)。

Ldelem_R8

將指定陣列索引為型別 float64 的元素載入到評估堆頂,作為型別 F (float)。

Ldelem_Ref

將包含指定陣列索引物件參考的元素載入到評估堆疊頂端,作為型別 O (物件參考)。

Ldelem_U1

將類型 unsigned int8 在指定陣列索引的元素載入到評估堆疊頂端,作為 int32

Ldelem_U2

將類型 unsigned int16 在指定陣列索引的元素載入到評估堆疊頂端,作為 int32

Ldelem_U4

將類型 unsigned int32 在指定陣列索引的元素載入到評估堆疊頂端,作為 int32

Ldelema

將指定陣列索引的陣列元素位址載入到評估堆疊頂端,作為型別 & (管理指標)。

Ldfld

尋找物件中某欄位的值,該欄位目前在評估堆疊上。

Ldflda

尋找物件中某欄位的位址,該欄位目前在評估堆疊上。

Ldftn

將一個未管理的指標(型別 native int)推送到實現特定方法的原生程式碼到評估堆疊中。

Ldind_I

間接將 類型的native intnative int值載入評估堆疊。

Ldind_I1

間接將 類型的int8int32值載入評估堆疊。

Ldind_I2

間接將 類型的int16int32值載入評估堆疊。

Ldind_I4

間接將 類型的int32int32值載入評估堆疊。

Ldind_I8

間接將 類型的int64int64值載入評估堆疊。

Ldind_R4

將型態 float32F 的值以型態(float)形式間接載入評估堆疊。

Ldind_R8

將型態 float64F 的值以型態(float)形式間接載入評估堆疊。

Ldind_Ref

將物件參考作為類型 O (物件參考)間接載入評估堆疊。

Ldind_U1

間接將 類型的unsigned int8int32值載入評估堆疊。

Ldind_U2

間接將 類型的unsigned int16int32值載入評估堆疊。

Ldind_U4

間接將 類型的unsigned int32int32值載入評估堆疊。

Ldlen

將一個零基、一維陣列的元素數推入評估堆疊。

Ldloc

將特定索引的本地變數載入評估堆疊。

Ldloc_0

將索引為 0 的本地變數載入評估堆疊。

Ldloc_1

將索引 1 的本地變數載入評估堆疊。

Ldloc_2

將索引 2 的本地變數載入評估堆疊。

Ldloc_3

將索引 3 的本地變數載入評估堆疊。

Ldloc_S

將特定索引的本地變數載入評估堆疊,簡短形式。

Ldloca

將特定索引的本地變數位址載入評估堆疊。

Ldloca_S

將特定索引的本地變數位址載入評估堆疊,簡稱。

Ldnull

將一個空參考(型別 O)推入評估堆疊。

Ldobj

將由位址指向的值型物件複製到評估堆疊頂端。

Ldsfld

將靜態欄位的值推送到評估堆疊上。

Ldsflda

將靜態欄位的位址推送到評估堆疊。

Ldstr

會將新的物件參考推送到儲存在元資料中的字串文字。

Ldtoken

將中繼資料標記轉換為執行時表示,推送到評估堆疊中。

Ldvirtftn

它會將一個未受管理的指標(型別 native int)推送到實現特定虛擬方法的原生程式碼到評估堆疊中。

Leave

離開受保護的程式碼區域,無條件將控制權轉移到特定目標指令。

Leave_S

離開受保護的程式碼區域,無條件將控制權轉移給目標指令(簡短形式)。

Localloc

從本地動態記憶體池分配一定數量的位元組,並將第一個分配的位元組的位址(暫態指標、型別 *)推入評估堆疊。

Mkrefany

將特定型別實例的型別引用推送到評估堆疊中。

Mul

將兩個值相乘,並將結果推送到評估堆疊。

Mul_Ovf

將兩個整數值相乘,執行溢位檢查,並將結果推送到評估堆疊中。

Mul_Ovf_Un

將兩個無符號整數值相乘,執行溢位檢查,並將結果推送到評估堆疊。

Neg

否定一個值,並將結果推送到評估堆疊中。

Newarr

將物件參考推送到一個新的零基、一維陣列,該陣列的元素屬於特定型態,並被推送到評估堆疊中。

Newobj

建立一個新的物件或一個值型別的新實例,將物件參考(型別 O)推送到評估堆疊。

Nop

如果操作碼有修補,則會填補空間。 雖然可以消耗一個處理週期,但不會執行有意義的操作。

Not

計算堆疊頂端整數值的位元補數,並將結果以相同類型推送至評估堆疊。

Or

計算堆疊頂端兩個整數值的位元補數,並將結果推入評估堆疊。

Pop

移除目前評估堆疊頂端的值。

Prefix1

這是保留指令。

Prefix2

這是保留指令。

Prefix3

這是保留指令。

Prefix4

這是保留指令。

Prefix5

這是保留指令。

Prefix6

這是保留指令。

Prefix7

這是保留指令。

Prefixref

這是保留指令。

Readonly

規定後續陣列位址操作在執行時不進行型別檢查,且回傳一個受管理指標,其可變性受限制。

Refanytype

擷取嵌入於型別引用中的型別標記。

Refanyval

擷取嵌入於類型參考中的位址(型別 &)。

Rem

除以兩個值,並將剩餘部分推入評估堆疊。

Rem_Un

除以兩個無符號值,並將其餘部分推入評估堆疊。

Ret

從目前方法回傳,將被呼叫者的評估堆疊中(若存在)將回傳值推入呼叫者的評估堆疊。

Rethrow

重新拋出目前的例外。

Shl

將整數值向左(以零為單位)向左移動指定位元數,將結果推入評估堆疊。

Shr

將整數值(符號)向右移動指定位元數,將結果推入評估堆疊。

Shr_Un

將無符號整數值(以零為單位)向右移動指定位元數,將結果推入評估堆疊。

Sizeof

將所提供值型態的大小(位元組)推送到評估堆疊。

Starg

將值儲存在評估堆疊頂端的參數槽中,指定索引的位置。

Starg_S

將值儲存在評估堆疊頂端的參數槽中指定的索引短形式。

Stelem

將給定索引的陣列元素替換為指令中指定的評估堆疊上的值。

Stelem_I

將給定索引的陣列元素替換為 native int 評估堆疊上的值。

Stelem_I1

將給定索引的陣列元素替換為 int8 評估堆疊上的值。

Stelem_I2

將給定索引的陣列元素替換為 int16 評估堆疊上的值。

Stelem_I4

將給定索引的陣列元素替換為 int32 評估堆疊上的值。

Stelem_I8

將給定索引的陣列元素替換為 int64 評估堆疊上的值。

Stelem_R4

將給定索引的陣列元素替換為 float32 評估堆疊上的值。

Stelem_R8

將給定索引的陣列元素替換為 float64 評估堆疊上的值。

Stelem_Ref

在評估堆疊上,將給定索引的陣列元素替換為物件 ref 值(型別 O)。

Stfld

將物件參考或指標欄位中儲存的值替換為新值。

Stind_I

在所提供的位址儲存型別 native int 值。

Stind_I1

在所提供的位址儲存型別 int8 值。

Stind_I2

在所提供的位址儲存型別 int16 值。

Stind_I4

在所提供的位址儲存型別 int32 值。

Stind_I8

在所提供的位址儲存型別 int64 值。

Stind_R4

在所提供的位址儲存型別 float32 值。

Stind_R8

在所提供的位址儲存型別 float64 值。

Stind_Ref

在提供的位址上儲存物件參考值。

Stloc

從評估堆疊頂端彈出當前值,並將其存入指定索引的本地變數清單中。

Stloc_0

將當前值從評估堆疊頂端彈出,並存入本地變數清單的索引 0。

Stloc_1

從評估堆疊頂端彈出目前值,並儲存在索引 1 的本地變數清單中。

Stloc_2

從評估堆疊頂端彈出當前值,並存入索引 2 的本地變數清單。

Stloc_3

從評估堆疊頂端彈出目前值,並存入索引 3 的本地變數清單。

Stloc_S

從評估堆疊頂端彈出當前值,並儲存在本地變數清單( index 簡短形式)。

Stobj

將特定類型的值從評估堆疊複製到提供的記憶體位址。

Stsfld

將靜態欄位的值替換為評估堆疊中的值。

Sub

從一個值減去另一個值,並將結果推送到評估堆疊中。

Sub_Ovf

從一個整數值中減去另一個整數值,執行溢位檢查,並將結果推送到評估堆疊中。

Sub_Ovf_Un

從另一個無符號整數值減去一個,執行溢位檢查,並將結果推送到評估堆疊。

Switch

實作跳轉表。

Tailcall

執行一個後置式方法呼叫指令,使得在實際呼叫指令執行前,已移除目前方法的堆疊框架。

Throw

拋出目前在評估堆疊上的例外物件。

Unaligned

表示目前位於評估堆疊頂端的位址可能未與緊接著的 ldindstindldfldstfldstobjldobjinitblkcpblk指令的自然大小對齊。

Unbox

將某值型別的盒裝表示轉換為未開框的形式。

Unbox_Any

將指令中指定的型別的盒狀表示轉換為未盒裝的形式。

Volatile

指定目前位於評估堆疊頂端的位址可能是揮發性的,且讀取該位置的結果無法快取,或無法抑制該位置的多個儲存。

Xor

計算評估堆疊上兩個值的位元異或,將結果推入評估堆疊。

方法

名稱 Description
Equals(Object)

判斷指定的 物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
TakesSingleByteArgument(OpCode)

若所提供的操作碼僅取一個位元組參數,則回傳真或假。

ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於