PostSharp 4.3 /
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.