Before and After

Apr 4, 2009 at 12:38 PM
So, we've got DuringMethodCallEventArgs, which implies that the aspect's code is executed at the same moment as the decorated method. Which is a bit misleading since in fact this code is executed before or even instead of the decorated code.

It would be cool if we could add code *after* the actual method. Better yet, wrap the method invocation in our code (similar to the Decorator attribute, where you can put CallDecoratedMethod() in the middle.

For example, I could measure the time a particular method takes to run, or even build the whole call tree.