Download demo project source code Yesterday we went over creating an aspect and applying it to a method. PostSharp is flexible in how aspects can be applied which results in outstanding benefits for us as developers. Imagine our exception wrapper aspect automatically being applied to any new method that is added to any class in the project. What about logging exceptions? No longer do we have to remember to add exception logging code to new methods. Of course, the practical applications are far beyond these simple scenarios but it gives you an idea of the power of PostSharp.
OnExceptionAspect is intended to work with methods. Yesterday we applied our aspect to the target method directly, which did the job but What happens when we need to profile multiple methods? What happens when we want to profile every method in every class? That's a lot of work if we were to manually apply the aspect to each method. OnMethodBoundaryAspect PostSharp comes with another aspect that we can use called OnMethodBoundaryAspect. This class allows us to intercept certain points in a method’s execution by providing...(Read whole news on source site)