Open sandboxFocus
  • TOC

Post­Sharp Documentation

Introduction

Deployment and Configuration

Adding Aspects to Code

Logging

Contracts

INotify­Property­Changed

Weak Event

XAML

Parent/Child, Visitor and Disposable

Undo/Redo

Caching

Multithreading

Developing Custom Aspects

Validating Architecture

Testing and Debugging

Miscellaneous

API Reference

Post­Sharp

Post­Sharp.​Aspects

Post­Sharp.​Aspects.​Advices

Post­Sharp.​Aspects.​Configuration

Post­Sharp.​Aspects.​Dependencies

Post­Sharp.​Aspects.​Internals

Post­Sharp.​Aspects.​Serialization

Post­Sharp.​Collections

Post­Sharp.​Constraints

Post­Sharp.​Extensibility

Post­Sharp.​Extensibility.​Build­Time­Logging

Post­Sharp.​Patterns

Post­Sharp.​Patterns.​Caching

Post­Sharp.​Patterns.​Caching.​Backends

Post­Sharp.​Patterns.​Caching.​Backends.​Azure

Post­Sharp.​Patterns.​Caching.​Backends.​Redis

Post­Sharp.​Patterns.​Caching.​Dependencies

Post­Sharp.​Patterns.​Caching.​Formatters

Post­Sharp.​Patterns.​Caching.​Implementation

Post­Sharp.​Patterns.​Caching.​Locking

Post­Sharp.​Patterns.​Caching.​Serializers

Post­Sharp.​Patterns.​Caching.​Value­Adapters

Post­Sharp.​Patterns.​Collections

Post­Sharp.​Patterns.​Collections.​Advices

Post­Sharp.​Patterns.​Contracts

Post­Sharp.​Patterns.​Diagnostics

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Core

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Framework

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Diagnostic­Source

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Http­Client

Post­Sharp.​Patterns.​Diagnostics.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Application­Insights

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Common­Logging

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Console

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Event­Source

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Log4Net

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Microsoft

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Multiplexer

Post­Sharp.​Patterns.​Diagnostics.​Backends.​NLog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Null

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Serilog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace­Source

Post­Sharp.​Patterns.​Diagnostics.​Contexts

Post­Sharp.​Patterns.​Diagnostics.​Correlation

Post­Sharp.​Patterns.​Diagnostics.​Custom

Post­Sharp.​Patterns.​Diagnostics.​Custom.​Messages

Post­Sharp.​Patterns.​Diagnostics.​Formatters

Post­Sharp.​Patterns.​Diagnostics.​Record­Builders

Post­Sharp.​Patterns.​Diagnostics.​Threading­Instrumentation

Post­Sharp.​Patterns.​Diagnostics.​Transactions

Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model

Post­Sharp.​Patterns.​Dynamic­Advising

Post­Sharp.​Patterns.​Formatters

Post­Sharp.​Patterns.​Model

Post­Sharp.​Patterns.​Model.​Controls

Post­Sharp.​Patterns.​Model.​Type­Adapters

Post­Sharp.​Patterns.​Recording

Post­Sharp.​Patterns.​Recording.​Operations

Post­Sharp.​Patterns.​Threading

Access­Level­Attribute3

Actor­Attribute8

Actor­Attribute.​Serializer4

Actor­Dispatcher

Ambient­Concurrency­Controller­Context

Assume­Immutable­Attribute2

Background­Attribute6

Concurrency­Controller­Factory

Concurrent­Access­Awaiter

Concurrent­Access­Exception3

Concurrent­Access­Token

Deadlock­Detected­Event­Args2

Deadlock­Detection­Policy5

Deadlock­Detection­Policy.​Serializer2

Deadlocked­Thread­Info

Deadlock­Exception3

Deadlock­Info

Dispatched­Attribute5

Dispatched­Attribute.​Serializer2

Dispatched­Execution­Mode

Dispatcher­Factory

Entry­Point­Attribute3

Explicitly­Synchronized­Attribute3

Freezable­Attribute9

Freezable­Attribute.​Serializer5

IActor

IActor­Controller

IActor­Dispatcher

IConcurrency­Controller

IDispatcher

IDispatcher­Object

IFreezable

IImmutable

Immutable­Attribute9

Immutable­Attribute.​Serializer5

IThread­Aware

Object­Read­Only­Exception2

Private­Thread­Aware­Attribute8

Private­Thread­Aware­Attribute.​Serializer4

Reader­Attribute4

Reader­Writer­Synchronized­Attribute8

Reader­Writer­Synchronized­Attribute.​Serializer4

Read­Only­Thread­Aware­Attribute8

Read­Only­Thread­Aware­Attribute.​Serializer4

Reentrant­Attribute3

Requires­Thread­Safe­Attribute5

Requires­Thread­Safe­Attribute.​Serializer2

Synchronized­Attribute8

Synchronized­Attribute.​Serializer4

Thread­Access­Exception3

Thread­Affine­Attribute8

Thread­Affine­Attribute.​Serializer4

Thread­Aware­Attribute7

Thread­Aware­Attribute.​Serializer3

Thread­Aware­Extensions

Threading­Exception2

Threading­Model

Threading­Patterns­Aspect­Roles

Threading­Services

Threading­Unhandled­Exception­Event­Args2

Threading­Unhandled­Exception­Source

Thread­Mismatch­Exception3

Thread­Safety­Policy5

Thread­Unsafe­Attribute8

Thread­Unsafe­Attribute.​Serializer4

Upgradeable­Reader­Attribute4

Writer­Attribute4

Yielder­Attribute4

Post­Sharp.​Patterns.​Threading.​Models

Post­Sharp.​Patterns.​Utilities

Post­Sharp.​Patterns.​Xaml

Post­Sharp.​Reflection

Post­Sharp.​Reflection.​Method­Body

Post­Sharp.​Serialization

  • Article

Class FreezableAttribute

Custom attribute that, when applied to a class, implements the FreezableThreadingModel to this class. The aspect introduces the IFreezable interface into the target class. After the Freeze() method has been invoked, the object can no longer be modified, and can therefore be safely shared between several threads.

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

Accessing a freezable object from a different thread than the one that created before the Freeze() method has been invoked it will result in a ThreadMismatchException.

Attempts to modify a freezable object after the Freeze() method has been invoked will result in an ObjectReadOnlyException.

Constructors

Name Description
FreezableAttribute()
FreezableAttribute(PortableFormatterConstructorContext)

Methods

Name Description
Advise(object)

Injects the advice into the child object.

OnCloned(ICloneAwareAspect)

Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone(). The this parameter refers to the new aspect instance in the cloned object.

ToString()
  • Navigation

In this article

Constructors

Methods