Open sandboxFocusImprove this doc

Adding Aspects to Code

An aspect has no effect until it is applied to some element of code. PostSharp provides multiple ways to add aspects to your code.

In this chapter

Section Description
Adding Aspects Declaratively Using Attributes This section shows how to add aspects to code using custom attributes and explains how you can target several declarations with a single line of code
Adding Aspects Using XML This section shows how to add aspects without modifying your source code, by using an external configuration file.
Adding Aspects Programmatically using IAspectProvider This section describes how to add aspects programmatically (by writing code that is executed at build-time) and overcome limitations of declarative approaches.