How to execute a method everytime before/after executing some other method which has many overloads?

前端 未结 2 1354
被撕碎了的回忆
被撕碎了的回忆 2021-01-06 09:51

I have an existing application which is already developed and is in use.

There are multiple overloads of one of the methods (called Read()) of a class. Now I want t

2条回答
  •  感情败类
    2021-01-06 10:17

    Have a generic method

    public void Read(T t) where t:ISomeCommonInterface
    {
       Before();
       Read(t);
       After();
    }
    

提交回复
热议问题