Open sandboxFocus

Class ImmutableAttribute

Custom attribute that, when applied to a class, implements the ImmutableThreadingModel to this class. The aspect introduces the IImmutable interface into the target class. Immutable objects cannot be modified after the constructor exits.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading.dll
Syntax
[IntroduceInterface(typeof(IImmutable), OverrideAction = InterfaceOverrideAction.Ignore, LinesOfCodeAvoided = 0)]
[Metric("UsedFeatures", "PostSharp.Patterns.Threading.Immutable")]
[Serializer(typeof(ImmutableAttribute.Serializer))]
public sealed class ImmutableAttribute : ReadOnlyThreadAwareAttribute, ITypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICloneAwareAspect, IInstanceScopedAspect, IAspectProvider, IService, IAdviceProvider, IAspect, IQueryInterface, IConcurrencyController, IImmutable, IThreadAware

Constructors

Name Description
ImmutableAttribute()
ImmutableAttribute(PortableFormatterConstructorContext)

Methods

Name Description
OnInstanceConstructed()