Class MethodSignature
- Namespace
- AsmResolver.DotNet.Signatures
- Assembly
- AsmResolver.DotNet.dll
Represents the signature of a method defined or referenced by a .NET executable file.
public class MethodSignature : MethodSignatureBase, IImportable
- Inheritance
-
MethodSignature
- Implements
- Inherited Members
Constructors
MethodSignature(CallingConventionAttributes, TypeSignature, IEnumerable<TypeSignature>)
Creates a new method signature with the provided return and parameter types.
public MethodSignature(CallingConventionAttributes attributes, TypeSignature returnType, IEnumerable<TypeSignature> parameterTypes)
Parameters
attributes
CallingConventionAttributesThe attributes.
returnType
TypeSignatureThe return type of the method.
parameterTypes
IEnumerable<TypeSignature>The types of the parameter the method defines.
Properties
GenericParameterCount
Gets or sets the number of generic parameters this method defines.
public int GenericParameterCount { get; set; }
Property Value
Methods
CreateInstance(TypeSignature)
Creates a new parameter-less method signature for an instance method.
public static MethodSignature CreateInstance(TypeSignature returnType)
Parameters
returnType
TypeSignatureThe return type of the method.
Returns
- MethodSignature
The signature.
CreateInstance(TypeSignature, params TypeSignature[])
Creates a method signature for an instance method that has a number of parameters.
public static MethodSignature CreateInstance(TypeSignature returnType, params TypeSignature[] parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
parameterTypes
TypeSignature[]The parameter types.
Returns
- MethodSignature
The signature.
CreateInstance(TypeSignature, IEnumerable<TypeSignature>)
Creates a method signature for an instance method that has a number of parameters.
public static MethodSignature CreateInstance(TypeSignature returnType, IEnumerable<TypeSignature> parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
parameterTypes
IEnumerable<TypeSignature>The parameter types.
Returns
- MethodSignature
The signature.
CreateInstance(TypeSignature, int, params TypeSignature[])
Creates a generic method signature for an instance method that has a number of parameters.
public static MethodSignature CreateInstance(TypeSignature returnType, int genericParameterCount, params TypeSignature[] parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
genericParameterCount
intThe number of generic parameters this method defines.
parameterTypes
TypeSignature[]The parameter types.
Returns
- MethodSignature
The signature.
CreateInstance(TypeSignature, int, IEnumerable<TypeSignature>)
Creates a generic method signature for an instance method that has a number of parameters.
public static MethodSignature CreateInstance(TypeSignature returnType, int genericParameterCount, IEnumerable<TypeSignature> parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
genericParameterCount
intThe number of generic parameters this method defines.
parameterTypes
IEnumerable<TypeSignature>The parameter types.
Returns
- MethodSignature
The signature.
CreateStatic(TypeSignature)
Creates a new parameter-less method signature for a static method.
public static MethodSignature CreateStatic(TypeSignature returnType)
Parameters
returnType
TypeSignatureThe return type of the method.
Returns
- MethodSignature
The signature.
CreateStatic(TypeSignature, params TypeSignature[])
Creates a method signature for a static method that has a number of parameters.
public static MethodSignature CreateStatic(TypeSignature returnType, params TypeSignature[] parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
parameterTypes
TypeSignature[]The parameter types.
Returns
- MethodSignature
The signature.
CreateStatic(TypeSignature, IEnumerable<TypeSignature>)
Creates a method signature for a static method that has a number of parameters.
public static MethodSignature CreateStatic(TypeSignature returnType, IEnumerable<TypeSignature> parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
parameterTypes
IEnumerable<TypeSignature>The parameter types.
Returns
- MethodSignature
The signature.
CreateStatic(TypeSignature, int, params TypeSignature[])
Creates a generic method signature for a static method that has a number of parameters.
public static MethodSignature CreateStatic(TypeSignature returnType, int genericParameterCount, params TypeSignature[] parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
genericParameterCount
intThe number of generic parameters this method defines.
parameterTypes
TypeSignature[]The parameter types.
Returns
- MethodSignature
The signature.
CreateStatic(TypeSignature, int, IEnumerable<TypeSignature>)
Creates a generic method signature for a static method that has a number of parameters.
public static MethodSignature CreateStatic(TypeSignature returnType, int genericParameterCount, IEnumerable<TypeSignature> parameterTypes)
Parameters
returnType
TypeSignatureThe return type of the method.
genericParameterCount
intThe number of generic parameters this method defines.
parameterTypes
IEnumerable<TypeSignature>The parameter types.
Returns
- MethodSignature
The signature.
FromReader(ref BlobReaderContext, ref BinaryStreamReader)
Reads a single method signature from an input stream.
public static MethodSignature FromReader(ref BlobReaderContext context, ref BinaryStreamReader reader)
Parameters
context
BlobReaderContextThe blob reader context.
reader
BinaryStreamReaderThe blob input stream.
Returns
- MethodSignature
The method signature.
ImportWith(ReferenceImporter)
Imports the method signature using the provided reference importer object.
public MemberSignature ImportWith(ReferenceImporter importer)
Parameters
importer
ReferenceImporterThe reference importer to us.
Returns
- MemberSignature
The imported signature.
ImportWithInternal(ReferenceImporter)
Imports the signature using the provided reference importer object.
protected override CallingConventionSignature ImportWithInternal(ReferenceImporter importer)
Parameters
importer
ReferenceImporterThe reference importer to us.
Returns
- CallingConventionSignature
The imported signature.
InstantiateGenericTypes(GenericContext)
Substitutes any generic type parameter in the method signature with the parameters provided by the generic context.
public MethodSignature InstantiateGenericTypes(GenericContext context)
Parameters
context
GenericContextThe generic context.
Returns
- MethodSignature
The instantiated method signature.
Remarks
When the type signature does not contain any generic parameter, this method might return the current instance of the method signature.
MakeFunctionPointerType()
Constructs a new function pointer type signature based on this method signature.
public FunctionPointerTypeSignature MakeFunctionPointerType()
Returns
- FunctionPointerTypeSignature
The new type signature.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
WriteContents(in BlobSerializationContext)
Serializes the blob (without extra data) to an output stream.
protected override void WriteContents(in BlobSerializationContext context)
Parameters
context
BlobSerializationContext