Open sandboxFocus

Class PureAttribute

Custom attribute that, when applied on a method, specifies that this method is a pure function, i.e. the method always returns the same result given the same parameter values. In the context of NotifyPropertyChangedAttribute, it is also assumed that pure functions have only parameters of primitive types (int, string, ...). The object parameter type is also accepted, but then it is assumed that instances passed are immutable (and changes to these objects will not be tracked).

Inheritance
PureAttribute
Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Method, AllowMultiple = true)]
[MulticastAttributeUsage(MulticastTargets.Method, PersistMetaData = true, AllowMultiple = false)]
public sealed class PureAttribute : MulticastAttribute, IValidableAnnotation

Constructors

Name Description
PureAttribute()

Methods

Name Description
CompileTimeValidate(object)

Method invoked at build time to ensure that the aspect has been applied to the right target.