// 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 System.Configuration; using Vajhoej.StaticWeaver; [Aspect] public class AttrFix { [Pointcut(Signature="* F.SomeAttribute::get_SomeValue()")] public static void AttrFixPointcut() { } [AfterCallAdvice(Pointcut="AttrFixPointcut")] public static void AttrFixAdvice(MethodJoinpoint mjp) { if(((string)mjp.Result).StartsWith("cfg:")) { mjp.Result = ConfigurationManager.AppSettings[((string)mjp.Result).Substring(4)]; } } }