C#提够的访问修饰符有:private,public,protected,internal,protected internal 1.成员(方法,字段,构造函数)可见性选项: class SomeClass { //可以从任何地方访问 public void PublicMethod() { } //仅可以从SomeClass类型中访问 private void PrivateMethod() { throw new System.NotImplementedException(); } //可以再SomeClass类和它的派生类中访问 protected void ProtectMethod() { throw new System.NotImplementedException(); } //可以在同一个程序集中访问 internal void InternalMethod() { throw new System.NotImplementedException(); } //在程序集中受保护的访问 protected internal void ProtectInternalMethod() { throw new System.NotImplementedException(); } //没有标记的成员在C#中默认为私有的 void SomeMethod() { throw new System.NotImplementedException(); } 现在假设创建一个SomeClass类的实例并尝试用点(.)运算来调用每一个方法 static void Main(String[] args) { SomeClass c = new SomeClass(); c.PublicMethod(); c.InternalMethod(); c.ProtectInternalMethod(); c.PrivateMethod(); //错误!!! c.ProtectMethod(); //错误!!! c.SomeMethod(); //错误!!! } 如果编译这个程序,你会发现受保护的和私有的成员都不能通过对象来访问!!! 2.设置类型可见性:类型(类,接口,结构,枚举,委托)也可以带访问修饰符,但只能是pubilc或internal,其中internal是类型默认的访问修饰符 转载于:https://www.cnblogs.com/dushouke/archive/2008/04/23/1168321.html