PostSharp Documentation

PostSharp Documentation

PostSharp is the #1 pattern-aware extension to C# and VB. It allows developers to eradicate boilerplate by offloading repeating work from humans to machines. PostSharp contains ready-made implementations of the most common patterns and gives you the tools to build automation for your own patterns.

Developers usually think in terms of design patterns, but with conventional programming languages, they end up writing boilerplate code. PostSharp extends the C# and VB languages with a notion of pattern. The result: shorter, cleaner code that’s easier to write and understand, contains fewer defects and is less expensive to maintain.

PostSharp started as an open-source project in 2004 and due to its popularity, it soon became a commercial product trusted by over 50,000 developers worldwide and over 1,000 leading corporations. More than 10% of all Fortune 500 companies including Microsoft, Intel, Bank of America, Phillips, NetApp, BP, Comcast, Volkswagen, Hitachi, Deutsche Bank, Bosch, Siemens, and Oracle rely on PostSharp to reduce their development and maintenance costs.

Benefits of using PostSharp

PostSharp helps you:

  1. stop writing boilerplate code and deliver features faster, at lower cost;

  2. build more reliable software;

  3. add or modify functionality after the first release;

  4. build thread-safe applications that everyone understands;

  5. get team members productive quicker.

To learn more about PostSharp's benefits, see Why to Use PostSharp.

Typical use of PostSharp

The following patterns are typically implemented using PostSharp:

Additionally, PostSharp provides the tools to automatically implement your own patterns and to validate hand-written code against architecture guidelines.


PostSharp differentiates itself from similar technologies by the following characteristics:

  • PostSharp does not require you to change your architecture like dependency injection (IoC) does.

  • PostSharp does not generate source code that you then have to maintain. New behaviors are added during compilation.

  • PostSharp is very fast at runtime because it is basically a build-time technology.

  • PostSharp comes with Visual Studio tooling so that you can still understand your code even if behaviors are not implemented in source code.

How to read this documentation?

Get the right version

We only publish the latest version of the documentation (for the latest version of the product) to If you need the documentation for a previous version of PostSharp, you can download it from

Get the right format

This documentation is available in several formats:




The online documentation is always up to date and works with all modern web browsers.


The old good MSHelp format is still a favorite one. The CHM rendering contains both conceptual documentation and the API reference.


The PDF format is optimized for print and is suitable for tablets. It does not contain the API reference.

Read it as a book

If you just discovered PostSharp and want to get started, we recommend you start by reading the Introduction. When you get at the topic How to Learn PostSharp, continue on the right learning path according to your role and interests.

Use it as a reference documentation

If you have already been using PostSharp for some time, you can use the current documentation as a reference and jump directly to the topic of interest. We suggest you have a look at What's New in PostSharp to make sure you are not missing the new features.