What is PostSharp?

PostSharp adds patterns and thread safety to C# and VB.

PostSharp automates the implementation of patterns so they don't turn into boilerplate.

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.


If it's repetitive, it can be automated.

Think about the following requirements. Have you ever hoped there would be a better way to implement them?


  • INotifyPropertyChanged
  • Undo/redo
  • Code contracts (preconditions)
  • Logging
  • Transaction handling
  • Exception handling
  • Thread dispatching
  • Thread synchronization
  • Immutable
  • Authorization
  • Audit
  • Caching