说白了
被 internal 修饰的东西只能在本程序集(当前项目)内被使用。
被 protected internal 修饰的属性/方法 可以在其他项目中,被派生类使用
例如有两个项目app1和app2.
app1是启动项目,而app2只是一个类库
-
-
- namespace app2
-
- {
-
- internal class cInternal
- {
-
- public int a;
-
- internal int b;
-
- }
-
- public class vInternal
- {
-
- internal int a;
-
- protected internal int b;
-
- public int c;
-
- protected internal void Display()
- {Console.WriteLine("Hello protected Internal");}
- }
-
- }
-
-
-
- using app2;
-
- namespace app1
- {
-
- class app1()
- {
- app2.cInternal InternalClass = new app2.cInternal();
-
- app2.vInternal InternalVar = new app2.vInternal ();
-
- InternalVar.a = 100;
-
- InternalVar.b = 100;
-
- InternalVar.c = 100;
-
- InternalVar.Display();
-
- }
-
-
- class InheritFromInternal:app2.vInternal
- {
- base.a = 100;
-
- base.b = 100;
-
- base.Display();
-
- }
-
- }
转自:http://blog.csdn.net/manmadewind/article/details/6638454