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

前端 未结 11 949
闹比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条回答
  •  Happy的楠姐
    2020-12-24 04:20

    In general if you have method like:

    Document.Copy(myDocumentObject, toPath);
    

    I think it is better to use a non-static method, because the first parameter being a Document suggests that it is really an operation on the document.

提交回复
热议问题