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
