Class CustomAttributeSignature
- Namespace
- AsmResolver.DotNet.Signatures
- Assembly
- AsmResolver.DotNet.dll
Represents the blob signature of a custom attribute, containing the arguments that are passed onto the attribute constructor.
public class CustomAttributeSignature : ExtendableBlobSignature
- Inheritance
-
CustomAttributeSignature
- Derived
- Inherited Members
Constructors
CustomAttributeSignature()
Creates a new empty custom attribute signature.
public CustomAttributeSignature()
CustomAttributeSignature(params CustomAttributeArgument[])
Creates a new custom attribute signature with the provided fixed arguments.
public CustomAttributeSignature(params CustomAttributeArgument[] fixedArguments)
Parameters
fixedArgumentsCustomAttributeArgument[]
CustomAttributeSignature(IEnumerable<CustomAttributeArgument>)
Creates a new custom attribute signature with the provided fixed arguments.
public CustomAttributeSignature(IEnumerable<CustomAttributeArgument> fixedArguments)
Parameters
fixedArgumentsIEnumerable<CustomAttributeArgument>
CustomAttributeSignature(IEnumerable<CustomAttributeArgument>, IEnumerable<CustomAttributeNamedArgument>)
Creates a new custom attribute signature with the provided fixed and named arguments.
public CustomAttributeSignature(IEnumerable<CustomAttributeArgument> fixedArguments, IEnumerable<CustomAttributeNamedArgument> namedArguments)
Parameters
fixedArgumentsIEnumerable<CustomAttributeArgument>namedArgumentsIEnumerable<CustomAttributeNamedArgument>
Fields
CustomAttributeSignaturePrologue
The header value of every custom attribute signature.
protected const ushort CustomAttributeSignaturePrologue = 1
Field Value
Properties
FixedArguments
Gets a collection of fixed arguments that are passed onto the constructor of the attribute.
public IList<CustomAttributeArgument> FixedArguments { get; }
Property Value
IsInitialized
Gets a value indicating whether the FixedArguments and NamedArguments collections are initialized or not.
protected bool IsInitialized { get; }
Property Value
NamedArguments
Gets a collection of values that are assigned to fields and/or members of the attribute class.
public IList<CustomAttributeNamedArgument> NamedArguments { get; }
Property Value
Methods
EnsureIsInitialized()
Ensures that the FixedArguments and NamedArguments are initialized.
protected void EnsureIsInitialized()
FromReader(in BlobReaderContext, ICustomAttributeType, in BinaryStreamReader)
Reads a single custom attribute signature from the input stream.
public static CustomAttributeSignature FromReader(in BlobReaderContext context, ICustomAttributeType ctor, in BinaryStreamReader reader)
Parameters
contextBlobReaderContextThe blob reader context.
ctorICustomAttributeTypeThe constructor that was called.
readerBinaryStreamReaderThe input stream.
Returns
- CustomAttributeSignature
The signature.
Exceptions
- FormatException
Occurs when the input stream does not point to a valid signature.
Initialize(IList<CustomAttributeArgument>, IList<CustomAttributeNamedArgument>)
Initializes the argument collections of the signature.
protected virtual void Initialize(IList<CustomAttributeArgument> fixedArguments, IList<CustomAttributeNamedArgument> namedArguments)
Parameters
fixedArgumentsIList<CustomAttributeArgument>The collection that will receive the fixed arguments.
namedArgumentsIList<CustomAttributeNamedArgument>The collection that will receive the named arguments.
IsCompatibleWith(ICustomAttributeType)
Validates whether the signature is compatible with the provided attribute constructor.
public bool IsCompatibleWith(ICustomAttributeType constructor)
Parameters
constructorICustomAttributeTypeThe constructor to validate against.
Returns
- bool
trueif the constructor is compatible,falseotherwise.
IsCompatibleWith(ICustomAttributeType, IErrorListener)
Validates whether the signature is compatible with the provided attribute constructor.
public virtual bool IsCompatibleWith(ICustomAttributeType constructor, IErrorListener listener)
Parameters
constructorICustomAttributeTypeThe constructor to validate against.
listenerIErrorListenerThe object responsible for reporting any errors during the validation of the signature.
Returns
- bool
trueif the constructor is compatible,falseotherwise.
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