OpCodes 類別

定義

提供 Microsoft Intermediate Language (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
屬性

範例

下列範例示範如何使用 ILGenerator 來發出 OpCodesMethodBuilder 的動態方法建構。

using namespace System;
using namespace System::Threading;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
Type^ CreateDynamicType()
{
   array<Type^>^ctorParams = {int::typeid,int::typeid};
   AppDomain^ myDomain = Thread::GetDomain();
   AssemblyName^ myAsmName = gcnew 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", int::typeid, FieldAttributes::Public );
   FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public );
   Type^ objType = Type::GetType( "System.Object" );
   ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array<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, void::typeid, nullptr );
   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})";
   array<Type^>^wlParams = {String::typeid,Object::typeid,Object::typeid};
   
   // We need the MethodInfo to pass into EmitCall later.
   MethodInfo^ writeLineMI = Console::typeid->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, int::typeid );
   
   // 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, int::typeid );
   
   // 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, nullptr );
   
   // 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();
}

int main()
{
   array<Object^>^ctorParams = gcnew array<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, nullptr, ptInstance, gcnew array<Object^>(0) );
}

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

備註

如需成員 opcode 的詳細描述,請參閱 Common Language Infrastructure (CLI) 檔,特別是「Partition III: CIL 指令集」 和 「Partition II: Metadata Definition and Semantics」。 如需詳細資訊,請參閱 ECMA 335 Common Language Infrastructure (CLI)

欄位

Add

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

Add_Ovf

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

Add_Ovf_Un

相加兩個不帶正負號的整數 (Unsigned Integer) 值、執行溢位檢查,並將結果推送至評估堆疊。

And

計算兩個值的位元 AND 運算,並將結果推送至評估堆疊。

Arglist

將 Unmanaged 指標傳回目前方法的引數清單。

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

將實值型別 (Value Type) 轉換成物件參考 (型別 O)。

Br

無條件地將控制權傳輸至目標指令。

Br_S

無條件地將控制權傳輸至目標指令 (簡短形式)。

Break

以訊號指示 Common Language Infrastructure (CLI) 向偵錯工具告知已經過中斷點。

Brfalse

如果 valuefalse、Null 參考 (在 Visual Basic 中為 Nothing) 或零,則將控制權傳輸至目標指令。

Brfalse_S

如果 valuefalse、Null 參考或零,則將控制權傳輸至目標指令。

Brtrue

如果 valuetrue、非 Null 或非零,則將控制權傳輸至目標指令。

Brtrue_S

如果 valuetrue、非 Null 或非零,則將控制權傳輸至目標指令 (簡短形式)。

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。 如果 value1 小於 value2,則將整數值 1 ((int32) 推入至評估堆疊,否則將 0 (int32) 推入至評估堆疊。

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

將評估堆疊頂端不帶正負號的整數 (Unsigned Integer) 值轉換成 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 子句傳回 Common Language Infrastructure (CLI) 例外處理常式。

Endfinally

將控制權從例外狀況區塊的 faultfinally 子句傳回 Common Language Infrastructure (CLI) 例外處理常式。

Initblk

將指定位址上的指定記憶體區塊初始化為指定的大小和初始值。

Initobj

將位於指定位址之值類型的各個欄位,初始化為適當之基本類型的 null 參考或 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 (浮點數)。

Ldc_R8

推入型別 float64 的提供值至評估堆疊做為型別 F (浮點數)。

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 (浮點數) 載入至評估堆疊的頂端。

Ldelem_R8

將位於指定陣列索引處型別為 float64 的元素當做型別 F (浮點數) 載入至評估堆疊的頂端。

Ldelem_Ref

載入包含位於指定的陣列索引中的物件參考元素至評估堆疊的頂端,做為型別 O (物件參考)。

Ldelem_U1

將位於指定陣列索引處型別為 unsigned int8 的元素當做 int32 載入至評估堆疊的頂端。

Ldelem_U2

將位於指定陣列索引處型別為 unsigned int16 的元素當做 int32 載入至評估堆疊的頂端。

Ldelem_U4

將位於指定陣列索引處型別為 unsigned int32 的元素當做 int32 載入至評估堆疊的頂端。

Ldelema

載入位於指定陣列索引中的陣列元素位址至評估堆疊的頂端,做為型別 & (Managed 指標)。

Ldfld

尋找物件中的欄位值,該值的參考目前位於評估堆疊中。

Ldflda

尋找物件中的欄位位址,該位址的參考目前位於評估堆疊中。

Ldftn

推入實作特定方法之機器碼的 Unmanaged 指標 (型別 native int) 至評估堆疊。

Ldind_I

將型別 native int 的值做為 native int,間接載入至評估堆疊。

Ldind_I1

int8 型別的值做為 int32 間接載入至評估堆疊。

Ldind_I2

int16 型別的值做為 int32 間接載入至評估堆疊。

Ldind_I4

int32 型別的值做為 int32 間接載入至評估堆疊。

Ldind_I8

int64 型別的值做為 int64 間接載入至評估堆疊。

Ldind_R4

將型別 float32 的值做為型別 F (浮點數),間接載入至評估堆疊。

Ldind_R8

將型別 float64 的值做為型別 F (浮點數),間接載入至評估堆疊。

Ldind_Ref

將物件參考做為型別 O (物件參考),間接載入至評估堆疊。

Ldind_U1

unsigned int8 型別的值做為 int32 間接載入至評估堆疊。

Ldind_U2

unsigned int16 型別的值做為 int32 間接載入至評估堆疊。

Ldind_U4

unsigned int32 型別的值做為 int32 間接載入至評估堆疊。

Ldlen

推送以零為起始的一維陣列的項目數至評估堆疊。

Ldloc

載入位於指定索引的區域變數至評估堆疊。

Ldloc_0

將位於索引 0 的區域變數載入至評估堆疊。

Ldloc_1

將位於索引 1 的區域變數載入至評估堆疊。

Ldloc_2

將位於索引 2 的區域變數載入至評估堆疊。

Ldloc_3

將位於索引 3 的區域變數載入至評估堆疊。

Ldloc_S

載入位於指定索引的區域變數至評估堆疊 (簡短形式)。

Ldloca

載入位於指定索引的區域變數位址至評估堆疊。

Ldloca_S

載入位於指定索引的區域變數位址至評估堆疊 (簡短形式)。

Ldnull

推入 Null 參考 (型別 O) 至評估堆疊。

Ldobj

複製位址所指向的實值類型物件到評估堆疊的頂端。

Ldsfld

推送靜態欄位的值至評估堆疊。

Ldsflda

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

Ldstr

推送新的物件參考至儲存於中繼資料的字串常值 (String Literal)。

Ldtoken

將中繼資料語彙基元轉換成它的執行階段表示,並將它推送至評估堆疊。

Ldvirtftn

推入實作與指定的物件相關聯的特定虛擬方法之機器碼的 Unmanaged 指標 (型別 native int) 至評估堆疊。

Leave

結束程式碼的保護區,無條件地將控制權傳輸至特定的目標指令。

Leave_S

結束程式碼的保護區,無條件地將控制權傳輸至目標指令 (簡短形式)。

Localloc

從區域動態記憶體集區中配置某些數量的位元組,並將第一個配置的位元組的位址 (暫時性指標,型別 *) 推入至評估堆疊。

Mkrefany

將特定類型的執行個體之類型參考推送至評估堆疊。

Mul

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

Mul_Ovf

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

Mul_Ovf_Un

將兩個不帶正負號的整數值相乘、執行溢位檢查,再將結果推送至評估堆疊。

Neg

將值變成相反值,並將結果推送至評估堆疊。

Newarr

將新的以零為起始一維陣列 (其項目屬於特定類型) 的物件參考推送至評估堆疊。

Newobj

建立實值型別的新物件或新執行個體,將物件參考 (型別 O) 推入至評估堆疊。

Nop

如果已完成修補作業碼,則填滿空間。 雖然會耗用處理循環,卻不會執行任何有意義的運算。

Not

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

Or

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

Pop

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

Prefix1

這是保留的指示。

Prefix2

這是保留的指示。

Prefix3

這是保留的指示。

Prefix4

這是保留的指示。

Prefix5

這是保留的指示。

Prefix6

這是保留的指示。

Prefix7

這是保留的指示。

Prefixref

這是保留的指示。

Readonly

指定後續陣列位址作業在執行階段不執行任何類型檢查,且會傳回限制其變動性的 Managed 指標。

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

以在評估堆疊上的物件參考值 (型別 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

表示目前位於評估堆疊頂端的位置可能未對齊緊接 ldindstindldfldstfldldobjstobjinitblkcpblk 指令的正常大小。

Unbox

將實值類型的 boxed 表示轉換成它的 unboxed 形式。

Unbox_Any

將指令中指定之類型的 boxed 表示轉換成其 unboxed 形式。

Volatile

指定目前在評估堆疊頂端的位址可能是 volatile,並且無法快取讀取該位置的結果,或者無法隱藏存放該位置的多個存放區。

Xor

計算評估堆疊頂端兩個值的位元 XOR,將結果推送至評估堆疊。

方法

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
TakesSingleByteArgument(OpCode)

如果提供的 Opcode 採用單一位元組引數,則傳回 True 或 False。

ToString()

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

(繼承來源 Object)

適用於