// 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 Error1 { // pointcut: // any Execption, within NewStuff.any pointcut MathError() : handler(Exception) && within(NewStuff.any); // advice: // before before() : MathError() { Console.WriteLine("AOP> Exception in math calculation: " + ((Exception)thisJoinPoint.Args[0]).Message); Environment.Exit(0); } } }