events - Custom attribute in .NET to execute code before and after decorated method? -
ideally i'd find way like:
[mycustomattribute()] public void mymethod() {     debug.write("b"); }  public mycustomattribute : attribute {     public void onbegin()     {         debug.write("a");        }      public void onend()     {         debug.write("c");     } }   which write:
abc
when mymethod() gets excuted. ideas if can done? actionfilter attribute seems similar idea, applies mvc requests.
take @ postsharp - pretty already.
it post processor - takes compiled assembly, looks attributes , injects code decorated methods.
Comments
Post a Comment