/ Published in: C#
Deserialize an XML object to an T type.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static T XmlDeserialize<T>(string filename) { T o = default(T); try { XmlReader reader = XmlReader.Create(filename); if (serializer.CanDeserialize(reader)) { o = (T)serializer.Deserialize(reader); } reader.Close(); } catch { } finally { } return o; }