为什么作为密封,在C#中的抽象声明静态类? [英] Why declare static classes as sealed and abstract in C#?
本文介绍了为什么作为密封,在C#中的抽象声明静态类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这MSDN文章说,由于密封和抽象静态类应该声明。我是IM pression静态类已经封下。为什么你还需要声明一个静态类封了?
This MSDN article states that static classes should be declared as sealed and abstract. I was under the impression that static classes were already sealed. Why would you also need to declare a static class as sealed?
推荐答案
我觉得那篇文章相关位的是:
I think the pertinent bit from that article is:
难道声明静态类的密封和抽象,并添加一个私有实例构造的如果您的编程语言没有内置对静态类的支持。的
"Do declare static classes as sealed and abstract, and add a private instance constructor, if your programming language does not have built-in support for static classes."
记住,.NET框架支持很多不同的语言。
Remember, the .NET framework supports a lot of different languages.
这篇关于为什么作为密封,在C#中的抽象声明静态类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文