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
attributesCallingConventionAttributesThe attributes.
returnTypeTypeSignatureThe return type of the method.
parameterTypesIEnumerable<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
returnTypeTypeSignatureThe 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
returnTypeTypeSignatureThe return type of the method.
parameterTypesTypeSignature[]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
returnTypeTypeSignatureThe return type of the method.
parameterTypesIEnumerable<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
returnTypeTypeSignatureThe return type of the method.
genericParameterCountintThe number of generic parameters this method defines.
parameterTypesTypeSignature[]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
returnTypeTypeSignatureThe return type of the method.
genericParameterCountintThe number of generic parameters this method defines.
parameterTypesIEnumerable<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
returnTypeTypeSignatureThe 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
returnTypeTypeSignatureThe return type of the method.
parameterTypesTypeSignature[]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
returnTypeTypeSignatureThe return type of the method.
parameterTypesIEnumerable<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
returnTypeTypeSignatureThe return type of the method.
genericParameterCountintThe number of generic parameters this method defines.
parameterTypesTypeSignature[]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
returnTypeTypeSignatureThe return type of the method.
genericParameterCountintThe number of generic parameters this method defines.
parameterTypesIEnumerable<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
contextBlobReaderContextThe blob reader context.
readerBinaryStreamReaderThe blob input stream.
Returns
- MethodSignature
The method signature.
ImportWith(ReferenceImporter)
Imports the method signature using the provided reference importer object.
public MethodSignature ImportWith(ReferenceImporter importer)
Parameters
importerReferenceImporterThe reference importer to us.
Returns
- MethodSignature
The imported signature.
ImportWithInternal(ReferenceImporter)
Imports the signature using the provided reference importer object.
protected override CallingConventionSignature ImportWithInternal(ReferenceImporter importer)
Parameters
importerReferenceImporterThe 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
contextGenericContextThe 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
contextBlobSerializationContext