不一致的可访问性字段类型WinPho8

时间:2014-06-04 15:23:12

标签: c# windows-phone-8 singleton

我的项目中有这个问题。

我已将一个类声明为单例,将其用作xml解析器。我想返回pois解析列表,但是我无法在不收到错误的情况下更改返回类型,因此我尝试声明一个全局变量以从其他类读取它但我收到此错误。

namespace XML_Parser
{
    public sealed class XMLParserPOI_Wiki
    {
        private List<POI> places;

        private static readonly XMLParserPOI_Wiki uniqueInstance = new XMLParserPOI_Wiki();

        public List<POI> getPlaces()
        {
            return places;
        }

        //Constructor
        private XMLParserPOI_Wiki(){
            System.Diagnostics.Debug.WriteLine("Constructor singleton created");
        }

        public static XMLParserPOI_Wiki getInstance()
        {
            return uniqueInstance;
        }

        public void parseWikitude(string url)
        {
            places = null;
            WebClient wc = new WebClient();
            wc.DownloadStringCompleted += HttpsCompleted;
            wc.DownloadStringAsync(new Uri(url));


        }

        private void HttpsCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                XDocument xdoc = XDocument.Parse(e.Result, LoadOptions.None);
                XNamespace ns = "http://www.opengis.net/kml/2.2";
                XNamespace ns2 = "http://www.openarml.org/wikitude/1.0";
                var placemarkers = xdoc.Root.Descendants(ns + "Placemark");

                places =
                (....).ToList();



            }
        }

    }
}

完整错误是:

Error   1   Inconsistent accessibility: 
field type 'System.Collections.Generic.List<XML_Parser.POI>' is 
less accessible than field 
'XML_Parser.XMLParserPOI_Wiki.places'   
C:\Users\vindi_000\documents\visual studio 2012\Projects\XML_Parser\XML_Parser\XMLParserPOI_Wiki.cs 
13  27  XML_Parser

1 个答案:

答案 0 :(得分:1)

此错误通常意味着您在公共成员中公开内部类,这是不可能的。

我想类XML_Parser.POI没有标记为公开?