public
The type or member can be accessed by any other code in the same assembly or another assembly that references it.
It is accessible for all.
private
The type or member can only be accessed by code in the same class or struct.
protected
The type or member can only be accessed by code in the same class or struct, or in a derived class.
internal
The type or member can be accessed by any code in the same assembly, but not from another assembly.
protected internal
The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.
A combination of protected and internal. This makes the member visible within the same assembly and also makes the member visible to an inheriting class. An inheriting class does not need to be in the same assembly to access the member.
C# default access modifier is : internal
本文深入探讨了C#中的访问修饰符,包括public、private、protected、internal和protected internal的作用及用法。
475

被折叠的 条评论
为什么被折叠?



