OpCode.Value Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the numeric value of the intermediate language (IL) instruction.

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

public short Value { get; }

Property Value

Type: System.Int16

Read-only. The numeric value of the IL instruction.

The Name property returns the string name that corresponds to the instruction's numeric value.

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

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Windows Phone
Available since 8.1
Return to top
Show: