XmlSerializer serializer = new XmlSerializer(typeof(Realestates));
using (StringReader reader = new StringReader(xml))
{
var test = (Realestates)serializer.Deserialize(reader);
}
XmlSerializer serializer = new XmlSerializer(typeof(Realestates));
using (StreamReader reader = new StreamReader(pathOfYourXMLFile))
{
var test = (Realestates)serializer.Deserialize(reader);
}
public static T GetSavedOptions<T>(string filename) where T : class
{
try
{
var xs = new XmlSerializer(typeof(T));
var filePath = GetOptionPath(filename);
using (var userData = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
return xs.Deserialize(userData) as T;
}
}
catch (Exception ex)
{
throw ex;
}
}