PostSharp SDK6.6//Post­Sharp.​Sdk.​Code­Model Namespace/Custom­Attribute­Declaration Class

CustomAttributeDeclaration Class

Represents a custom attribute (CustomAttribute).
Inheritance Hierarchy
System.Object
  PostSharp.Sdk.CodeModel.Element
    PostSharp.Sdk.CodeModel.Declaration
      PostSharp.Sdk.CodeModel.MetadataDeclaration
        PostSharp.Sdk.CodeModel.CustomAttributeDeclaration

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 6.6.3.0 (6.6.3.0)
Syntax
C#
public sealed class CustomAttributeDeclaration : MetadataDeclaration, 
	IAnnotationInstance, IAnnotationValue, IRemovable, IMetadataDeclaration, IDeclaration, 
	IElement, IModuleElement, ITaggable, ICloneableModuleElement

The CustomAttributeDeclaration type exposes the following members.

Constructors
  NameDescription
Public methodCustomAttributeDeclaration(IMethod)
Initializes a new instance of the CustomAttributeDeclaration type.
Public methodCustomAttributeDeclaration(IAnnotationValue, ModuleDeclaration)
Initializes a new instance of the CustomAttributeDeclaration class
Properties
  NameDescription
Public propertyConstructor
Gets the custom attribute constructor.
Public propertyCustomDebuggingInformation (Inherited from Declaration.)
Public propertyIsOriginal
Determines whether the current declaration existed in the source assembly.
(Inherited from MetadataDeclaration.)
Public propertyMetadataToken
Gets or sets the token of the current declaration.
(Inherited from MetadataDeclaration.)
Public propertyOriginalDeclaration
When the declaration represents another declaration in the source assembly, this property refers to this declaration. When using GetReflectionObject(Type[], Type[], BindingOptions), the original declaration should actually be retrieved.
(Inherited from MetadataDeclaration.)
Public propertyParentMember
Gets the parent member of the current declaration.
(Overrides MetadataDeclaration.ParentMember.)
Public propertyParentType
Gets the parent type of the current declaration.
(Overrides MetadataDeclaration.ParentType.)
Public propertySymbol
Methods
  NameDescription
Public methodClearCache
Clear the cache (typically mapping to System.Reflection or, if the current element is a reference, to the related definition) of the current Element and all its children.
(Inherited from Element.)
Public methodClone
Public methodConstructRuntimeObject
Gets the runtime object constructed from the current instance.
Public methodDispose Obsolete. (Inherited from MetadataDeclaration.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetTag<T>
Gets a tag associated with the current declaration.
(Inherited from MetadataDeclaration.)
Public methodGetTokenType
Gets the TokenType of the derived declaration.
(Overrides MetadataDeclaration.GetTokenType().)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInvalidateSerialization
Invalidates the original serialization. Indicates that the serialization should be computed again, if requested.
Public methodRemove
Remove the current declaration from its parent.
Public methodSetTag<T>
Set a tag to the current declaration.
(Inherited from MetadataDeclaration.)
Public methodToString (Overrides MetadataDeclaration.ToString().)
Public methodTranslate
Translates the custom attribute so that it can be used in another module.
Extension Methods
  NameDescription
Public Extension MethodConstructRuntimeObject()Overloaded.
Construct the instance (typically an object derived from Attribute) represented a given IAnnotationValue. This overload uses reflection to locate the constructor, and does not work if the target framework is not .NET Framework.
(Defined by CustomAttributeHelper.)
Public Extension MethodConstructRuntimeObject(Type)Overloaded.
Construct the instance represented by a given IAnnotationValue, given its type passed as an argument. This overload is safe even when the target framework is not .NET Framework.
(Defined by CustomAttributeHelper.)
Public Extension MethodConstructRuntimeObject(SerializedValueBindingOptions)Overloaded.
Construct the instance (typically an object derived from Attribute) represented a given IAnnotationValue, and specifies options. This overload uses reflection to locate the constructor, and does not work if the target framework is not .NET Framework.
(Defined by CustomAttributeHelper.)
Public Extension MethodConstructRuntimeObject(Type, SerializedValueBindingOptions)Overloaded.
Construct the instance represented by a given IAnnotationValue, given its type passed as an argument, and specifies options. This overload is safe even when the target framework is not .NET Framework.
(Defined by CustomAttributeHelper.)
Public Extension MethodConstructRuntimeObject<T>()Overloaded.
Construct the instance represented by a given IAnnotationValue, given its type passed as a generic argument. This overload is safe even when the target framework is not .NET Framework.
(Defined by CustomAttributeHelper.)
Public Extension MethodConstructRuntimeObject<T>(SerializedValueBindingOptions)Overloaded.
Construct the instance represented by a given IAnnotationValue, given its type passed as a generic argument, and specifies options. This overload is safe even when the target framework is not .NET Framework.
(Defined by CustomAttributeHelper.)
Public Extension MethodRender()Overloaded.
Renders a custom attribute value to a string.
(Defined by CustomAttributeHelper.)
Public Extension MethodRender(StringBuilder)Overloaded.
Renders a custom attribute value to an existing StringBuilder.
(Defined by CustomAttributeHelper.)
Public Extension MethodSetRuntimeObjectNamedArguments
Sets the fields and properties of an object (using reflection) given the named arguments of an IAnnotationValue.
(Defined by CustomAttributeHelper.)
Public Extension MethodToObjectConstruction
Converts an IAnnotationValue into an ObjectConstruction.
(Defined by AnnotationValueExtensions.)
Remarks

Any MetadataDeclaration can have custom attributes. They are exposed on the CustomAttributes property.

If you change any member of an instance of CustomAttributeDeclaration, you have to call the InvalidateSerialization() to force the custom attribute to be serialized again.

See Also