Do Aspect Oriented Programming using PostSharp (IL Weaving)
I was try to run following code in LINQPad as C# Program expecting following output:
pre invocation
This is func
post invocation
I'm able to do it in visual studio but not in LINQPad, what could be the reason ?
pre invocation
This is func
post invocation
I'm able to do it in visual studio but not in LINQPad, what could be the reason ?
void Main()
{
Test t = new Test();
t.func();
}
[Serializable]
public class CacheAspect : MethodInterceptionAspect
{
public override void OnInvoke(MethodInterceptionArgs args)
{
Console.WriteLine("pre invocation");
base.OnInvoke(args);
Console.WriteLine("post invocation");
}
}
public class Test
{
[CacheAspect()]
public void func()
{
Console.WriteLine("This is func");
}
}
Comments