Best way to prevent a class from being Instantiated?

后端 未结 5 1961
北海茫月
北海茫月 2020-12-14 20:20

I need to know how to prevent a class from being Instantiated in .net?

I know few methods like making the class Abstract and Static.

Is there any more way to

5条回答
  •  情深已故
    2020-12-14 20:56

    Mark the constructor(s) private, protected or if in used from another assembly, internal

提交回复
热议问题