What is an internal sealed class in C#?

后端 未结 6 442
长情又很酷
长情又很酷 2021-01-31 13:31

I was looking through some C# code for extending language support in VS2010 (Ook example). I saw some classes called internal sealed class

What do these do?

6条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 14:04

    Internal means the member is accessible to other types that are defined in the same assembly. A Sealed class is sort of the oppositie of abstract. It can be instantiated but cannot serve as a base class. The primary reason to seal a class is to prevent your users from fiddling around with it and breaking it. It’s also the case that sealing a class permits certain compiler optimizations that are not possible with non-sealed classes.

提交回复
热议问题