File: PostSharp.Samples.ExceptionHandling\


Exception handling is one of the most common sources of boilerplate code and makes the business logic less readable. With PostSharp, you can define exception handling policies centrally and apply them to your business logic from a single point.

This example implements two aspects:

By combining these two aspects, you can achieve better maintainability of your application without making the code unreadable and thus unmanageable.

What is being demonstrated?

This example demonstrates the following techniques:

Now you know how to use PostSharp to handle exceptions from one place, with good separation of concerns. The logic you implement this way makes your code much more maintainable and easier to read.


This example is not concerned with many details you are concerned with in your production code: