c# 的访问修饰符是private 还是 internal?

准确的说,不能一概而论。


[MSDN]
Classes and structs that are not nested within other classes or structs can be either public or internal. A type deleted as public is accessible by any other type. A type deleted as internal is only accessible by types within the same assembly. Classes and structs are deleted as internal by default unless the keyword public is added to the class definition, as in the previous example. Class or struct definitions can add the internal keyword to make their access level explicit. Access modifiers do not affect the class or struct itself — it always has access to itself and all of its own members.


类(class)或结构(struct)如果不是在其它类或结构中的话,它的访问类型要不就是internal, 要不就是public;
换句话说,如果它在其它类或结构中的话,则可以为private 或protected等。下面我说的类和结构,如无特殊说明,均指非"类中类"
类或结构的默认访问类型是internal.
类中所有的成员,默认均为private。

原文地址:https://www.cnblogs.com/baoconghui/p/2018969.html