Open sandboxFocus

Class Depends

Provides a way to specify dependencies of a method on properties or chains of properties. This class should be used from getters of properties marked with the SafeForDependencyAnalysisAttribute custom attribute.

Inheritance
Depends
Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model.dll
Syntax
public static class Depends
Remarks

Members of this class are considered metadata-only. They are used only at build time, when their arguments are decompiled. They have no run-time effect. For performance reasons, it is preferable to skip their execution at run time. You can do this by using the Guard field in the following construct:

if ( Depends.Guard )
{
Depends.On(this.foo.Bar);
}

Use this class for dependencies that the analysis cannot discover, such as dependencies hidden behind a virtual method or a delegate call. Pass each dependency as an expression such as this.field.Property.

Fields

Name Description
Guard

A bool value that is always false.

Methods

Name Description
On(object)

Specifies an explicit dependency between the calling method and the argument passed to this method.

On(object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object, object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object, object, object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

On(object, object, object, object, object, object, object, object, object, object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

See Also