0

We have a class with a static int property that we use for counting executions of certain methods within that class.

At the moment, we simply add increment code to each property we wish to track.

It would be cleaner if we could simply add an attribute to the method and then have the increment happen behind the scenes. If this is even possible, I'd imagine you do something like this:

    private static int StepCount { get; set; }

    [PreStep(ClickCounter())]
    public void MyMethod()
    {

    }

    private ClickCounter()
    {
        StepCount++;
    }

Anyone know if this sort of thing is possible?

Robbie Dee
  • 1,847
  • 16
  • 43

0 Answers0