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# – 受保护的内部保护和内部受保护之间有区别吗? - 代码日志