public Layer[] GetMapLayers() { var mapLayer = xrootElement.Elements("layer"); Layer[] layer = new Layer[mapLayer.Count()]; int key = 0; foreach (var VARIABLE in mapLayer) { layer[key].name = VARIABLE.Attribute("name").Value; layer[key].width = int.Parse(VARIABLE.Attribute("width").Value); layer[key].height = int.Parse(VARIABLE.Attribute("height").Value); layer[key].data = VARIABLE.Element("data").Value.Split(','); key++; } return(layer); }