Custom attribute that, when applied to a method, specifies that the method requires read access to the object.
Implements
Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading.dll
Syntax
[MulticastAttributeUsage(MulticastTargets.Method, TargetMemberAttributes = MulticastAttributes.Instance, AllowMultiple = false)]
public class ReaderAttribute : AccessLevelAttribute, IValidableAnnotationRemarks
Read access cannot be upgraded. A method that requires write access cannot be called while the current thread holds read access, and throws a LockRecursionException. Use UpgradeableReaderAttribute on a method that calls a method that requires write access.
When the target method is an iterator, the read access is held from the first call of MoveNext()
until the enumeration completes or the enumerator is disposed. Dispose the enumerator, for instance with a foreach or using
statement, when the enumeration does not complete.
Constructors
| Name | Description |
|---|---|
| ReaderAttribute() |