Class PureAttribute
- Namespace
- NDepend.Attributes
- Assembly
- NDepend.API.dll
This attribute can be used to declare a method as pure.
[AttributeUsage(AttributeTargets.Method)]
public sealed class PureAttribute : Attribute
- Inheritance
-
PureAttribute
- Inherited Members
- Extension Methods
Remarks
A method is pure if it cannot be called in a way to provoque a side-effect.
The properties IMethod.ChangesObjectState and IMethod.ChangesTypeState can be used to determine whether a method is pure or not.
A code rule is provided by default to continuously make sure that all methods tagged with this attribute are pure.
A code rule is provided by default to continuously make sure that all pure methods are tagged with this attribute.
Since .NET v4, you can also use the attribute type System.Diagnostics.Contracts.PureAttribute declared in mscorlib (only for VS projects on which Microsoft Code Contract is enabled, else the PureAttribute is discarded by the compiler).
Constructor (1)
PureAttribute()
Create a new instance of the PureAttribute class.
public PureAttribute()