page 2 of 2
Comments: 28 | Views: 3841
http://www.postsharp.org/

Its possible with a little bit of AOP
Custom Attribute That Traces

public class TraceAttribute : OnMethodBoundaryAspect 

  public override void OnEntry( MethodExecutionEventArgs eventArgs) 
  { Trace.TraceInformation("Entering {0}.", eventArgs.Method);  } 

  public override void OnExit( MethodExecutionEventArgs eventArgs) 
  { Trace.TraceInformation("Leaving {0}.", eventArgs.Method);   } 
}


Then all you do is add an attribute to a variable/method/class/assembly

To get this to actually work, download postsharp and follow the simple sample projects. btw there are alot of speed considerations to be made before using something like this, watch out for those anonymous methods Smiley

btw the example is at the link http://www.postsharp.org/
ill paste it again just incase anyone else missed it...
http://www.postsharp.org/
http://www.postsharp.org/
http://www.postsharp.org/
http://www.postsharp.org/
http://www.postsharp.org/
http://www.postsharp.org/
http://www.postsharp.org/
page 2 of 2
Comments: 28 | Views: 3841
Microsoft Communities