Class CustomMethod
Provides a base class for System.Reflection.MethodInfo subclasses that implement ICustomMethod.
Inheritance
Implements
Inherited Members
Namespace: CilTools.Reflection
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public abstract class CustomMethod : MethodInfo, ICustomAttributeProvider, _MemberInfo, _MethodBase, _MethodInfo, ICustomMethod
Remarks
In CIL Tools 2.3 and earlier, all custom methods were inheriting from this class. Starting from version 2.4, custom method classes could implement ICustomMethod and are not required to inherit from this specific class.
Constructors
CustomMethod()
Declaration
protected CustomMethod()
Properties
InitLocals
When overridden in the derived class, specifies whether the local variables are initialized
Declaration
public abstract bool InitLocals { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
InitLocalsSpecified
When overridden in the derived class, specifies whether the InitLocals
property value is defined
Declaration
public abstract bool InitLocalsSpecified { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MaxStackSize
When overridden in the derived class, returns the maximum size of operand stack during method execution
Declaration
public abstract int MaxStackSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxStackSizeSpecified
When overridden in the derived class, specifies whether the MaxStackSize property value is defined
Declaration
public abstract bool MaxStackSizeSpecified { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ReturnType
Gets the return type of this method.
Declaration
public override Type ReturnType { get; }
Property Value
Type | Description |
---|---|
System.Type |
Overrides
ReturnTypeCustomAttributes
Declaration
public override ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
Property Value
Type | Description |
---|---|
System.Reflection.ICustomAttributeProvider |
Overrides
TokenResolver
When overridden in the derived class, returns an object that can be used to convert metadata tokens into corresponding reflection objects
Declaration
public abstract ITokenResolver TokenResolver { get; }
Property Value
Type | Description |
---|---|
ITokenResolver |
Methods
GetBaseDefinition()
Declaration
public override MethodInfo GetBaseDefinition()
Returns
Type | Description |
---|---|
System.Reflection.MethodInfo |
Overrides
GetBytecode()
When overridden in the derived class, returns the CIL bytecode of the method body
Declaration
public abstract byte[] GetBytecode()
Returns
Type | Description |
---|---|
System.Byte[] | CIL bytecode as byte array |
GetDefinition()
When overridden in the derived class, gets the method definition for the generic method. Returns null if this instance does not represent the generic method.
Declaration
public virtual MethodBase GetDefinition()
Returns
Type | Description |
---|---|
System.Reflection.MethodBase |
Remarks
The default implementation always returns null
GetExceptionBlocks()
When overridden in the derived class, returns the list of exception handling blocks in the method's body
Declaration
public abstract ExceptionBlock[] GetExceptionBlocks()
Returns
Type | Description |
---|---|
ExceptionBlock[] |
GetLocalVariables()
Returns the array of local variable declarations of this method
Declaration
public virtual LocalVariable[] GetLocalVariables()
Returns
Type | Description |
---|---|
LocalVariable[] |
Remarks
The default implementation reads local varaibles from the signature returned by GetLocalVarSignature method
GetLocalVarSignature()
When overridden in the derived class, returns the local variable signature as an array of bytes
Declaration
public abstract byte[] GetLocalVarSignature()
Returns
Type | Description |
---|---|
System.Byte[] |
GetPInvokeParams()
When overridden in the derived class, gets P/Invoke parameters for the imported unmanaged method. Returns null if this instance does not represent an imported unmanaged method.
Declaration
public virtual PInvokeParams GetPInvokeParams()
Returns
Type | Description |
---|---|
PInvokeParams |
Remarks
The default implementation always returns null