In C#, how do I keep certain method calls out of the codebase entirely?

后端 未结 6 1045
迷失自我
迷失自我 2021-01-01 23:54

I\'m trying to get rid of all DateTime.Now method calls and replace them with my own GetNow() method, which may sometimes return a fixed date for t

6条回答
  •  别那么骄傲
    2021-01-02 00:29

    There's no real way to enforce something like this.

    The closest you're going to come is making a custom FxCop rule or custom Visual Studio Code Analysis rule to error/warn on calls to DateTime.Now.

提交回复
热议问题