PostSharpDeveloping Custom AspectsDeveloping Simple Aspects
Open sandboxFocusImprove this doc

Developing Simple Aspects

Simple aspects are aspects that are composed of a single transformation. Developing a simple aspect in PostSharp is straightforward: you just have to create a new class, derive it from a primitive aspect class, and override some special methods named advices.

If your aspect cannot be implemented as a single transformation, see Developing Composite Aspects.

In this section:

Article Description
Injecting Behaviors Before and After Method Execution This article shows how to execute code when a method starts, succeeds, or fails, around await operators of async methods, or yield return statements of iterator methods.
Handling Exceptions This article describes how to write an aspect that handles exceptions.
Intercepting Methods This article explains how to intercept the execution of methods.
Intercepting Properties and Fields This article shows how to intercept read and write accesses to fields and properties.
Intercepting Events This article describes how to intercept the action of adding a delegate to an event, removing a delegate from an event, and invoking a delegate by raising the event.
Introducing Custom Attributes This article shows how to add a custom attribute to any element of code.
Introducing Managed Resources This article shows how to add a managed resource to the current assembly.