Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
[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

XML
Inconsistent accessibility: property type 'System.Collections.Generic.List<Common.Person.websiteList>'
 is less accessible than property 'Common.Person.Website_Recording'
Posted
Updated 4-Apr-13 23:30pm
v2
Comments
Nicholas Marty 5-Apr-13 5:34am    
Should work... Have you tried a rebuild?
Keith Barrow 5-Apr-13 6:12am    
Just compiled it on my machine, it should work. I'd try a clean and re-built as Nicholas Marty suggests (or even restart VS - this has fixed things for me in the past).
Despite my deleted reply, both the property and the nested class have the same visibility (public) so you shouldn't be getting this error.
Pheonyx 5-Apr-13 6:20am    
Also, looking at this code, are you trying to use it in a WCF application?
If so, you might need to define "WebsiteList" with a [DataContract] attribute, and its properties with the "[DataMember]" attributes because the client might not understand them (it is just a guess with that though.)

1 solution

I suspect it relates to the following:

OnPropertyChanged("website_Recording");

Change that to:

OnPropertyChanged("Website_Recording");


Also I would not advice putting the websiteList class inside the Person class. Instead have that declared separately.
 
Share this answer
 
v2
Comments
Keith Barrow 5-Apr-13 5:48am    
That will cause problems to anything that relies upon INotifyPropertyChanged, but won't cause the bug described
Nicholas Marty 5-Apr-13 5:51am    
Didn't spot the typo.. However I also think it's always better not to nest classes if not necessary.. However this should not cause the bug as the class is public...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900