OpCode.Value Property

Definition

Obtient la valeur numérique de l'instruction en langage intermédiaire (IL).Gets the numeric value of the intermediate language (IL) instruction.

public:
 property short Value { short get(); };
public short Value { get; }
member this.Value : int16
Public ReadOnly Property Value As Short

Property Value

Int16

Lecture seule.Read-only. Valeur numérique de l'instruction IL.The numeric value of the IL instruction.

Examples

L’exemple suivant affiche les valeurs de propriété de l’instruction OpCodes.Add.The following example displays the property values of the OpCodes.Add instruction.

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

public class Example
{
   public static void Main()
   {
      OpCode op = OpCodes.Add;
      foreach (var prp in op.GetType().GetProperties())
         Console.WriteLine("{0} ({1}): {2}", prp.Name,
                           prp.PropertyType.Name, prp.GetValue(op));
   }
}
// The example displays the following output:
//       OperandType (OperandType): InlineNone
//       FlowControl (FlowControl): Next
//       OpCodeType (OpCodeType): Primitive
//       StackBehaviourPop (StackBehaviour): Pop1_pop1
//       StackBehaviourPush (StackBehaviour): Push1
//       Size (Int32): 1
//       Value (Int16): 88
//       Name (String): add
Imports System.Reflection
Imports System.Reflection.Emit

Module Example
   Public Sub Main()
      Dim op As OpCode = OpCodes.Add
      For Each prp In op.GetType().GetProperties()
         Console.WriteLine("{0} ({1}): {2}", prp.Name, 
                           prp.PropertyType.Name, prp.GetValue(op))
      Next
   End Sub
End Module
' The example displays the following output:
'       OperandType (OperandType): InlineNone
'       FlowControl (FlowControl): Next
'       OpCodeType (OpCodeType): Primitive
'       StackBehaviourPop (StackBehaviour): Pop1_pop1
'       StackBehaviourPush (StackBehaviour): Push1
'       Size (Int32): 1
'       Value (Int16): 88
'       Name (String): add

Remarks

La propriété Name retourne le nom de la chaîne qui correspond à la valeur numérique de l’instruction.The Name property returns the string name that corresponds to the instruction's numeric value.

Applies to