c# – 受保护的内部保护和内部受保护之间有区别吗?

前端之家收集整理的这篇文章主要介绍了c# – 受保护的内部保护和内部受保护之间有区别吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
public class TestClass
{
    protected internal int FieldA;
    internal protected int FieldB;    
}

受保护的内部成员和内部成员之间是否存在差异?

解决方法

Is there a difference between protected internal and internal protected
members?

它们之间没有区别.

受保护的内部意味着保护或内部

内部保护意味着内部或受保护.

The type or member can be accessed by any code in the assembly in
which it is declared,or from within a derived class in another
assembly. Access from another assembly must take place within a class
declaration that derives from the class in which the protected
internal element is declared,and it must take place through an
instance of the derived class type.

在这两者中,通常使用受保护的内部. MSDN page about Access Modifiers上没有对内部保护的引用.

另请参阅Phil Haack的博客文章What Does Protected Internal Mean?

猜你在找的C#相关文章