/// <summary>
/// DeSerialize Class Object from XML
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="xml"></param>
/// <returns></returns>
public static T XmlDeserialize<T>(string xml)
{
//deserialize to object
XmlSerializer ser = new XmlSerializer(typeof(T));
T obj = (T)ser.Deserialize(XmlReader.Create(new StringReader(xml)));
return obj;
}
/// DeSerialize Class Object from XML
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="xml"></param>
/// <returns></returns>
public static T XmlDeserialize<T>(string xml)
{
//deserialize to object
XmlSerializer ser = new XmlSerializer(typeof(T));
T obj = (T)ser.Deserialize(XmlReader.Create(new StringReader(xml)));
return obj;
}
No comments:
Post a Comment