zoukankan      html  css  js  c++  java
  • C#的protected internal

    关于C#的protected internal,也许你在网上可以找到两种解释:


    第一种解释是,protected or internal ,即在本程序集或其他程序集继承的子类可以访问。

    第二种解释是,protected and internal,即在本类或本程序集继承的子类可以访问。



    这需要判断protected  internal 是何种解释,就要从微软的MSDN中得到答案。


    摘要原文:

    protected internal


    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.


    译文:

    该类型或成员可以在声明的程序集的程序集中的任何代码或在另一个程序集内的派生类中访问。从另一个程序集的访问必须发生在一个类声明中,该类声明中声明受保护的内部元素的类,它必须通过派生类类型的实例发生。



    微软开发者:


    protected internal


    由其声明的程序集或另一个程序集派生的类中任何代码都可访问的类型或成员。 从另一个程序集进行访问必须在类声明中发生,该类声明派生自其中声明受保护的内部元素的类,并且必须通过派生的类类型的实例发生。


    所以,protected  internal 是本程序集其他程序集继承的子类可以访问。

  • 相关阅读:
    C# 基础笔记
    ASP.Net Jquery 随机验证码 文本框判断
    html 随机验证码
    冒泡排序
    工厂方法模式[Factory Mothod]
    单例设计模式[Singleton]
    设计模式之SOLID原则
    linux下配置zookeeper
    linux中安装nginx
    linux安装tomcat
  • 原文地址:https://www.cnblogs.com/maokun/p/6710815.html
Copyright © 2011-2022 走看看