Show / Hide Table of Contents

Interface ICustomMethod

Represents an object that provides custom information about method. Implement this interface on your custom class inheriting from System.Reflection.MethodBase if you want CilTools.BytecodeAnalysis library to process bytecode from your custom data source, instead of the standard reflection.

Namespace: CilTools.Reflection
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public interface ICustomMethod
Remarks

In CIL Tools 2.3 and earlier, CustomMethod was used as a base class for custom methods. Starting from version 2.4, ICustomMethod interface is used instead; and custom method classes could inherit from any class, as long as it is derived from System.Reflection.MethodBase.

Properties

InitLocals

Gets the value specifying whether the local variables are initialized

Declaration
bool InitLocals { get; }
Property Value
Type Description
System.Boolean

InitLocalsSpecified

Gets the value specifying whether the InitLocals property value is defined

Declaration
bool InitLocalsSpecified { get; }
Property Value
Type Description
System.Boolean

MaxStackSize

Gets the maximum size of operand stack during method execution

Declaration
int MaxStackSize { get; }
Property Value
Type Description
System.Int32

MaxStackSizeSpecified

Gets the value specifying whether the MaxStackSize property value is defined

Declaration
bool MaxStackSizeSpecified { get; }
Property Value
Type Description
System.Boolean

ReturnType

Gets the type of this method's return value

Declaration
Type ReturnType { get; }
Property Value
Type Description
System.Type
Remarks

Returns null if the return type is not applicable (such as for constructors).

TokenResolver

Gets an object that can be used to convert metadata tokens into corresponding reflection objects

Declaration
ITokenResolver TokenResolver { get; }
Property Value
Type Description
ITokenResolver

Methods

GetBytecode()

Gets the CIL bytecode of the method body

Declaration
byte[] GetBytecode()
Returns
Type Description
System.Byte[]

CIL bytecode as byte array

GetDefinition()

Gets the method definition for the generic method. Returns null if this instance does not represent the generic method.

Declaration
MethodBase GetDefinition()
Returns
Type Description
System.Reflection.MethodBase

GetExceptionBlocks()

Gets the list of exception handling blocks in the method's body

Declaration
ExceptionBlock[] GetExceptionBlocks()
Returns
Type Description
ExceptionBlock[]

GetLocalVariables()

Gets the array of local variable declarations of this method

Declaration
LocalVariable[] GetLocalVariables()
Returns
Type Description
LocalVariable[]

GetLocalVarSignature()

Gets the local variable signature as an array of bytes

Declaration
byte[] GetLocalVarSignature()
Returns
Type Description
System.Byte[]

GetPInvokeParams()

Gets P/Invoke parameters for the imported unmanaged method. Returns null if this instance does not represent an imported unmanaged method.

Declaration
PInvokeParams GetPInvokeParams()
Returns
Type Description
PInvokeParams
Back to top CIL Tools (published from sources in GitHub repository).
Generated by DocFX