locked
How repair "is inaccessible due to its protection level on windows 8.1"

    Question

  • query.cs

    class query

    {

      public object list_singer()
            {
                XDocument xml = XDocument.Load(@"Assets/XMLsinger.xml");
                List<Music> singer = (from q in xml.Elements("music").Elements("singer")
                                      select new Music
                                      {
                                          name = (string)q.Element("name").Value,
                                          images = (string)q.Element("images").Value,
                                          avatar = (string)q.Element("avatar").Value


                                      }


                                      ).ToList();
                return singer;
            }

    }

    Music.cs

     class Music

    {

      string name { get; set; }
            string info { get; set; }
            string avatar { get; set; }
            string images { get; set; }

    }

    Error:

    'MusicStore.data.avatar' is inaccessible due to its protection level
    Friday, May 9, 2014 8:06 AM

Answers

  • change your music class to:

     public class Music
    
    {
    public  string name { get; set; }
    public         string info { get; set; }
    public         string avatar { get; set; }
    public         string images { get; set; } 
    
    }
    


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Friday, May 9, 2014 8:54 AM