Method can be made static, but should it?

后端 未结 14 1274
说谎
说谎 2020-11-22 17:16

Resharper likes to point out multiple functions per asp.net page that could be made static. Does it help me if I do make them static? Should I make them static and move them

14条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 17:51

    You should do what is most readable and intuitive in a given scenario.

    The performance argument is not a good one except in the most extreme situations as the only thing that is actually happening is that one extra parameter (this) is getting pushed onto the stack for instance methods.

提交回复
热议问题