得到设置属性错误 [英] get set property error

查看:72
本文介绍了得到设置属性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[DataContract]
   public class Person : INotifyPropertyChanged
   {
    private List<websiteList> website_Recording  ;
s
    [DataMember]
        public List<websiteList> Website_Recording
        {
            get { return website_Recording; }
            set
            {
                website_Recording = value;
                OnPropertyChanged("website_Recording");
            }
        }
       public class websiteList
       {
           public string websit { get; set; }
           public Int32 id { get; set; }
       }

    }









错误是







the error is

Inconsistent accessibility: property type 'System.Collections.Generic.List<Common.Person.websiteList>'
 is less accessible than property 'Common.Person.Website_Recording'

推荐答案

我怀疑它与以下内容有关:



I suspect it relates to the following:

OnPropertyChanged("website_Recording");



更改为:




Change that to:

OnPropertyChanged("Website_Recording");





我也不建议推荐Person类中的websiteList类。而是单独声明。



Also I would not advice putting the websiteList class inside the Person class. Instead have that declared separately.


这篇关于得到设置属性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆