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]可以使得数据支持序列化和反序列化

  • 相关阅读:
    Combox小问题
    数据库登录名,用户,角色以及权限分配
    UDP初识
    AJax 无刷新构建DataTable
    批量修改数据库构架SQL
    Jquery Ajax
    Linq中使用Group By
    对象的消息模型
    P2P网络技术概览与实现原理
    ajax(1)
  • 原文地址:https://www.cnblogs.com/dowtowne/p/3464660.html
Copyright © 2011-2022 走看看