I have this issue in my project.
I have declared a class as a singleton to use it as xml parser. I wanted to return list of pois parsed but I wasn't able to change the return type without getting an error so I tried to declared a global variable to read it from other classes but I am receiving this error.
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();
}
}
}
}
complete error is:
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