zoukankan      html  css  js  c++  java
  • 错误 1 “Entities.PlanPrjEntity.PlanPrjs”不可访问,因为它受保护级别限制

          本人第一次是用List做父类,写了一个类PlanPrjs,如下:

    class PlanPrj
        {
            public int ID
            {
                get;
                set;        
            }
    
            public string Name
            {
                get;
                set;
            }
        }
        class PlanPrjs : List<PlanPrj>
        {
            //private List<PlanPrj> innerList = null;
    
            public PlanPrjs()
            {
                //innerList = new List<PlanPrj>();
            }
        }
    

      但是报了如下错误:

         错误1“Entities.PlanPrjEntity.PlanPrjs”不可访问,因为它受保护级别限制

         错误 3 “Entities.PlanPrjEntity.PlanPrjs.PlanPrjs()”不可访问,因为它受保护级别限制 

         解决方案:

         在Class 之前添加Public:

    [Serializable]
    

      添加之后的代码如下:

    public class PlanPrj
        {
            public int ID
            {
                get;
                set;        
            }
    
            public string Name
            {
                get;
                set;
            }
        }
    
        [Serializable]
        public class PlanPrjs : List<PlanPrj>
        {
            //private List<PlanPrj> innerList = null;
    
            public PlanPrjs()
            {
                //innerList = new List<PlanPrj>();
            }
        }

          要说明的是[Serializable]可以使得数据支持序列化和反序列化

  • 相关阅读:
    vue_03
    vue03
    vue2
    vue02
    vue 01
    JavaScript要点 (一) 变量-作用域
    在iOS应用程序中打开设备设置界面及其中某指定的选项界面
    多线程操作Coredata(转)
    iOS_城市定位
    本地验证码
  • 原文地址:https://www.cnblogs.com/dowtowne/p/3464660.html
Copyright © 2011-2022 走看看