关于 Protected internal这个访问级别,MSDN 上是这么说的:
http://msdn.microsoft.com/zh-cn/library/ba0a1yw2(VS.80).aspx
protected internal | 访问仅限于从包含类派生的当前程序集或类型。 |
而, CLR Via C# 中是这么解释的:
Family 或者 Assembly: 方法可由任何程序集中的派生类调用,方法也可以由同一个程序集中的任何类型调用. C#使用 protected internal 修饰符 来标志 Family或者 Asssembly.
两者解释的含义貌似是不同的 , MSDN上的解释感觉很别扭,甚至貌似有些: Family and Assembly的意思了. 经实际验证, CLR via C#中的解释是正确的. 难道MSDN 翻译的问题? 带着这个怀疑,小子便对比了一下英文的 MSDN
http://msdn.microsoft.com/en-us/library/ba0a1yw2(VS.80).aspx
protected internal | Access is limited to the current assembly or types derived from the containing class. |
可以看出英文的意义是很明确的,小子认为,正确明晰的翻译应该如下:
protected internal | 访问仅限于当前程序集, 或者任何程序集中的派生类 |
贴一点佐证如下:
http://msdn.microsoft.com/en-us/library/ms173121.aspx
protected internal
The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.
The protected internal accessibility means protected OR internal, not protected AND internal. In other words, a protected internal member is accessible from any class in the same assembly, including derived classes. To limit accessibility to only derived classes in the same assembly, declare the class itself internal, and declare its members as protected.