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

后端 未结 6 1044
迷失自我
迷失自我 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:42

    One approach might be to add a pre-commit hook to your source control repository of choice to look for DateTime.Now and abort the check-in if you find the offending string. It's not foolproof and it might be annoying to your colleagues but it should help keep it out of the codebase.

提交回复
热议问题