1
Good night!
I can’t use the data I do the XML deserialization, there is no exception or anything like that... I already checked the path, data but I can not list the data...
XML:
<?xml version="1.0" encoding="utf-8"?>
<Implement>
<Locais>
<Local>Tipo1</Local>
</Locais>
<TempoResposta>12</TempoResposta>
<Auxilio>S</Auxilio>
</Implement>
Class:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Xml.Serialization;
namespace Liber.Util
{
public class XMLConnectionString
{
[XmlRoot("Locais"), XmlType("Locais")]
public class Locais
{
[XmlElement("Local")]
public string Local { get; set; }
}
[XmlRoot("Implement"), XmlType("Implement")]
public class Implement
{
[XmlElement("Locais")]
public Locais Locais { get; set; }
[XmlElement("TempoResposta")]
public string TempoResposta { get; set; }
[XmlElement("Auxilio")]
public string Auxilio { get; set; }
}
public void desserializaConnectionString(string local)
{
FileInfo fi = new FileInfo(local);
if (fi.Exists)
{
//ele entra aqui...
FileStream fs = new FileStream(local, FileMode.Open);
XmlRootAttribute xra = new XmlRootAttribute("Implement");
XmlSerializer xs = new XmlSerializer(typeof(List<Implement>), xra);
List<Implement> lista = (List<Implement>)xs.Deserialize(fs);
fs.Close();
foreach(Implement c in lista)
{
MessageBox.Show(c.TempoResposta);
}
}
else
{
}
}
}
}
By no means can I print on canvas through the:
Messagebox.Show(c.TempoResposta.Tostring())
Or Console.Writeline(c.TempoResposta.Tostring())
Or even access the object’s data.. Does anyone know what it can be ?