PostSharpAPI ReferencePost­Sharp.​Patterns.​ThreadingThread­Affine­Attribute
Open sandboxFocus

Class ThreadAffineAttribute

Custom attribute that, when applied on a type, ensures the instances of this type can only be accessed by the thread that created the instance. When a different thread accesses instances of this type, a ThreadMismatchException exception is thrown.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading.dll
Syntax
[Metric("UsedFeatures", "PostSharp.Patterns.Threading.ThreadAffine")]
[Serializer]
public sealed class ThreadAffineAttribute : ThreadAwareAttribute, ITypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICloneAwareAspect, IInstanceScopedAspect, IAspectProvider, IService, IAdviceProvider, IAspect, IThreadAware, IQueryInterface

Constructors

Name Description
ThreadAffineAttribute() PostSharp.Patterns.Threading.ThreadAffineAttribute
ThreadAffineAttribute(PortableFormatterConstructorContext)

Methods

Name Description
RuntimeInitializeInstance()

Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.