You may be able to do something here with AOP, perhaps through PostSharp ; but unles, you are going to do this lots , I would argue in favor of its simplicity and just add additional code.
Of course, it becomes more complicated if you need polymorphism and the need for overriding in order to still call the first method (possibly involving an open non-virtual method and a protected virtual method):
public void Foo() { Bar() FooCore(); } protected virtual void FooCore() {...}
Marc gravell
source share