suppose I have this class:
Class Foo:
method1(){}
method2(){}
method3(){}
...
And suppose I have some action I wanted to do repeatedly in several methods in the class. Each action will take before the methods occur and after it occur. Is there an elegant way to implement it? The only way came to my mind:
private void Setup(Action action)
{
//Do something before
action
//Do something after
}
private void method1(args)
{
Setup(()=>method)
}
But it will make me call repeatedly call for Setup in each function I would like to implement it.