C#: DeSerialize object to xml file
DeSerialize object to xml file
private static void DeSerialize() { try { var testObject = new TestClass(); var serializer = new XmlSerializer(testObject.GetType()); var reader = new StreamReader(Filename); var deserialized = serializer.Deserialize(reader.BaseStream); testObject = (TestClass)deserialized; reader.Dispose(); } catch (Exception ex) { throw new Exception(ex.Message); } }
Tag: deserialize, c#, xml
0 Comments