Open sandboxFocus

Class AssumeImmutableAttribute

Custom attribute that, when applied to a type, means that the type should be assumed to be immutable. The custom attribute can be applied to a type on assembly level by specifying the Type property using the AssumeImmutableAttribute(Type) constructor.

Inheritance
AssumeImmutableAttribute
Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = true)]
public sealed class AssumeImmutableAttribute : Attribute

Constructors

Name Description
AssumeImmutableAttribute()

Initializes a new instance of the AssumeImmutableAttribute class that can be applied to a specific type.

AssumeImmutableAttribute(Type)

Initializes a new instance of the AssumeImmutableAttribute class that can be applied to an assembly, passing the immutable type as a constructor argument. This constructor allows adding assumptions for types that are not defined in the current assembly.

Properties

Name Description
TargetType

Gets the type that should be assumed immutable, if the AssumeImmutableAttribute(Type) constructor was used.