Making all methods static

后端 未结 7 2106
-上瘾入骨i
-上瘾入骨i 2020-12-25 08:20

In my application there are many classes which contain methods for processing data which can be computation and data enrichment.

My question is - if the class doesn\

7条回答
  •  旧巷少年郎
    2020-12-25 08:42

    It depends on need,if we want to make methods static or not. A good thumb rule is if the method is going to called (used) across the application for performing some standard operations it is usually ok to consider making them static. Drawback of overusing static is related to disposing and releasing object since, static method will stay in memory till program is stopped (re-started), overuse of static can have some impact on memory consumption.

提交回复
热议问题