// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using DotNetGuru.AspectDNG.Joinpoints; public class MethodTracker { [AroundCall("* A.*::*(*)")] public static object intercept(JoinPoint jp) { if(jp is MethodJoinPoint) { MethodJoinPoint mjp = (MethodJoinPoint)jp; Console.WriteLine("Before " + mjp.TargetOperation.Name + " (AOP)"); } object res = jp.Proceed(); if(jp is MethodJoinPoint) { MethodJoinPoint mjp = (MethodJoinPoint)jp; Console.WriteLine("After " + mjp.TargetOperation.Name + " (AOP)"); } return res; } }