Why are static classes used?

后端 未结 6 1046
故里飘歌
故里飘歌 2021-01-17 23:23

I have doubts on static class and static methods. From MSDN I understood that \"Static classes and class members are used to create data and functions that can be accessed w

6条回答
  •  伪装坚强ぢ
    2021-01-18 00:03

    Applying the static keyword to a class is a C# language convention, it doesn't mean anything special to the CLR. It merely makes sure that all members are static as well and that you can't accidentally create an instance of the class with the new keyword.

    The merits of static methods are discussed in this thread.

提交回复
热议问题