// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; namespace NewStuff { // aspect public aspect Trace2 { // pointcut: // any return type, class NewStuff.IntMath, any method name, any arguments // any return type, class NewStuff.DoubleMath, any method name, any arguments pointcut MathTrace() : execution(public static any NewStuff.IntMath.any(..)) || execution(public static any NewStuff.DoubleMath.any(..)); // advice: // around object around() : MathTrace() && aroundptr(adp) { Console.WriteLine("AOP> Enter " + thisJoinPoint.Signature); object res = adp.InnerInvoke(); Console.WriteLine("AOP> Enter " + thisJoinPoint.Signature); return res; } } }