// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using DotNetGuru.AspectDNG.Joinpoints; namespace OldStuff { // aspect public class Trace { // advice: // around // pointcut: // any return type, class OldStuff.IntMath, any method name, any arguments // any return type, class OldStuff.DoubleMath, any method name, any arguments [AroundCall("* OldStuff.IntMath::*(*)")] [AroundCall("* OldStuff.DoubleMath::*(*)")] public static object MathTrace(MethodJoinPoint mjp) { Console.WriteLine("AOP> Enter " + mjp); object res = mjp.Proceed(); Console.WriteLine("AOP> Exit " + mjp); return res; } } }