FluentAOP to intercept static methods

Aug 8, 2012 at 3:12 PM


Can FluentAOP be used to intercept static methods calls such as DateTime.Now? Would there be an example of how it could be done?


Aug 21, 2012 at 6:04 AM


Sorry, but only virtual or interface members can be intercepted. Static methods are not virtual, therefore that isn't possible. Any AOP library|framework, based on runtime IL-Weaving, has the same limitation.

I'd suggest to take a look at http://www.sharpcrafters.com. Compile time IL-Weaving makes possible to modify a compiled assembly and add|remove logic from any method (static, private, etc.)