Show / Hide Table of Contents

Class CustomMethod

Provides a base class for System.Reflection.MethodInfo subclasses that implement ICustomMethod.

Inheritance
System.Object
System.Reflection.MemberInfo
System.Reflection.MethodBase
System.Reflection.MethodInfo
CustomMethod
Implements
System.Reflection.ICustomAttributeProvider
System.Runtime.InteropServices._MemberInfo
System.Runtime.InteropServices._MethodBase
System.Runtime.InteropServices._MethodInfo
ICustomMethod
Inherited Members
System.Reflection.MethodInfo.Equals(System.Object)
System.Reflection.MethodInfo.GetHashCode()
System.Reflection.MethodInfo.GetGenericArguments()
System.Reflection.MethodInfo.GetGenericMethodDefinition()
System.Reflection.MethodInfo.MakeGenericMethod(System.Type[])
System.Reflection.MethodInfo.CreateDelegate(System.Type)
System.Reflection.MethodInfo.CreateDelegate(System.Type, System.Object)
System.Reflection.MethodInfo.System.Runtime.InteropServices._MethodInfo.GetType()
System.Reflection.MethodInfo.System.Runtime.InteropServices._MethodInfo.GetTypeInfoCount(System.UInt32)
System.Reflection.MethodInfo.System.Runtime.InteropServices._MethodInfo.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Reflection.MethodInfo.System.Runtime.InteropServices._MethodInfo.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Reflection.MethodInfo.System.Runtime.InteropServices._MethodInfo.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Reflection.MethodInfo.MemberType
System.Reflection.MethodInfo.ReturnParameter
System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle)
System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle, System.RuntimeTypeHandle)
System.Reflection.MethodBase.GetCurrentMethod()
System.Reflection.MethodBase.GetParameters()
System.Reflection.MethodBase.GetMethodImplementationFlags()
System.Reflection.MethodBase.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
System.Reflection.MethodBase.Invoke(System.Object, System.Object[])
System.Reflection.MethodBase.GetMethodBody()
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.GetType()
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.GetTypeInfoCount(System.UInt32)
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Reflection.MethodBase.MethodImplementationFlags
System.Reflection.MethodBase.MethodHandle
System.Reflection.MethodBase.Attributes
System.Reflection.MethodBase.CallingConvention
System.Reflection.MethodBase.IsGenericMethodDefinition
System.Reflection.MethodBase.ContainsGenericParameters
System.Reflection.MethodBase.IsGenericMethod
System.Reflection.MethodBase.IsSecurityCritical
System.Reflection.MethodBase.IsSecuritySafeCritical
System.Reflection.MethodBase.IsSecurityTransparent
System.Reflection.MethodBase.IsPublic
System.Reflection.MethodBase.IsPrivate
System.Reflection.MethodBase.IsFamily
System.Reflection.MethodBase.IsAssembly
System.Reflection.MethodBase.IsFamilyAndAssembly
System.Reflection.MethodBase.IsFamilyOrAssembly
System.Reflection.MethodBase.IsStatic
System.Reflection.MethodBase.IsFinal
System.Reflection.MethodBase.IsVirtual
System.Reflection.MethodBase.IsHideBySig
System.Reflection.MethodBase.IsAbstract
System.Reflection.MethodBase.IsSpecialName
System.Reflection.MethodBase.IsConstructor
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsPublic
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsPrivate
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsFamily
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsAssembly
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsFamilyAndAssembly
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsFamilyOrAssembly
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsStatic
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsFinal
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsVirtual
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsHideBySig
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsAbstract
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsSpecialName
System.Reflection.MethodBase.System.Runtime.InteropServices._MethodBase.IsConstructor
System.Reflection.MemberInfo.GetCustomAttributes(System.Boolean)
System.Reflection.MemberInfo.GetCustomAttributes(System.Type, System.Boolean)
System.Reflection.MemberInfo.IsDefined(System.Type, System.Boolean)
System.Reflection.MemberInfo.GetCustomAttributesData()
System.Reflection.MemberInfo.System.Runtime.InteropServices._MemberInfo.GetType()
System.Reflection.MemberInfo.System.Runtime.InteropServices._MemberInfo.GetTypeInfoCount(System.UInt32)
System.Reflection.MemberInfo.System.Runtime.InteropServices._MemberInfo.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Reflection.MemberInfo.System.Runtime.InteropServices._MemberInfo.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Reflection.MemberInfo.System.Runtime.InteropServices._MemberInfo.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Reflection.MemberInfo.Name
System.Reflection.MemberInfo.DeclaringType
System.Reflection.MemberInfo.ReflectedType
System.Reflection.MemberInfo.CustomAttributes
System.Reflection.MemberInfo.MetadataToken
System.Reflection.MemberInfo.Module
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
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
System.Reflection.MethodInfo.ReturnType

ReturnTypeCustomAttributes

Declaration
public override ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
Property Value
Type Description
System.Reflection.ICustomAttributeProvider
Overrides
System.Reflection.MethodInfo.ReturnTypeCustomAttributes

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
System.Reflection.MethodInfo.GetBaseDefinition()

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

Implements

System.Reflection.ICustomAttributeProvider
System.Runtime.InteropServices._MemberInfo
System.Runtime.InteropServices._MethodBase
System.Runtime.InteropServices._MethodInfo
ICustomMethod

Extension Methods

CilExtensions.GetCilGraph(MethodBase)
CilExtensions.GetCilText(MethodBase)
CilExtensions.GetInstructions(MethodBase)
CilExtensions.GetReferencedMethods(MethodBase)
CilExtensions.GetReferencedMembers(MethodBase)
CilExtensions.GetReferencedMembers(MethodBase, MemberCriteria)
Back to top CIL Tools (published from sources in GitHub repository).
Generated by DocFX