Table of Contents

Struct CilOpCode

Namespace
AsmResolver.PE.DotNet.Cil
Assembly
AsmResolver.PE.dll

Describes the operation that a single CIL instruction performs.

public readonly struct CilOpCode
Inherited Members

Properties

Byte1

Gets the first byte that appears in the instruction stream encoding this operation.

public byte Byte1 { get; }

Property Value

byte

Byte2

Gets the second byte that appears in the instruction stream encoding this operation.

public byte Byte2 { get; }

Property Value

byte

Remarks

This property only has meaning if IsLarge is true.

Code

Gets the value of the operation code.

public CilCode Code { get; }

Property Value

CilCode

FlowControl

Gets a value indicating the flow control behaviour of the operation.

public CilFlowControl FlowControl { get; }

Property Value

CilFlowControl

IsLarge

Gets a value indicating whether the operation code is large or not. If this value is true, the code needs two bytes to be encoded, otherwise it only needs one.

public bool IsLarge { get; }

Property Value

bool

IsValid

Gets a value indicating whether the opcode is valid and interpreted by the runtime.

public bool IsValid { get; }

Property Value

bool

Mnemonic

Gets the mnemonic of the operation code.

public string Mnemonic { get; }

Property Value

string

OpCodeType

Gets a value indicating the category of the operation code.

public CilOpCodeType OpCodeType { get; }

Property Value

CilOpCodeType

OperandType

Gets a value indicating the category of the operand.

public CilOperandType OperandType { get; }

Property Value

CilOperandType

Size

Gets the size in bytes of the operation code.

public int Size { get; }

Property Value

int

Remarks

This does not include the operand of the instruction.

StackBehaviourPop

Gets a value indicating the stack pop behaviour of the instruction.

public CilStackBehaviour StackBehaviourPop { get; }

Property Value

CilStackBehaviour

StackBehaviourPush

Gets a value indicating the stack push behaviour of the instruction.

public CilStackBehaviour StackBehaviourPush { get; }

Property Value

CilStackBehaviour

Methods

Equals(CilOpCode)

Determines whether the provided operation code is encoding the same operation.

public bool Equals(CilOpCode other)

Parameters

other CilOpCode

The other operation code.

Returns

bool

true if the same operation code is encoded, false otherwise.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(CilOpCode, CilOpCode)

Determines whether two operation codes encode the same operation.

public static bool operator ==(CilOpCode a, CilOpCode b)

Parameters

a CilOpCode

The first operation code.

b CilOpCode

The second operation code.

Returns

bool

true if the same operation code is encoded, false otherwise.

operator !=(CilOpCode, CilOpCode)

Determines whether two operation codes do not encode the same operation.

public static bool operator !=(CilOpCode a, CilOpCode b)

Parameters

a CilOpCode

The first operation code.

b CilOpCode

The second operation code.

Returns

bool

true if a different operation code is encoded, false otherwise.