OpCode.Value Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Read-only. The numeric value of the IL instruction.
Examples
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
The Name property returns the string name that corresponds to the instruction's numeric value.
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.