How to decide between C# static and non-static methods?

前端 未结 11 978
闹比i
闹比i 2020-12-24 03:35

[Edit]

My original-question was \"Why to decide between static and non-static? Both do the same...\"

Unfortunately it was edited to a C#-specific question wh

11条回答
  •  我在风中等你
    2020-12-24 04:12

    My "rule" is:

    • If I don't need to use properties from my class, make it static. (in other words, if the method is not really attached to the class, just there for logic association, use static )

提交回复
热议问题