// these lines do the actual serialization
XmlSerializer mySerializer = new XmlSerializer(typeof(myTestClass));
StreamWriter myWriter = new StreamWriter("c:/myTestClass.xml");
mySerializer.Serialize(myWriter, test);
myWriter.Close();
Output:-
version="1.0" encoding="utf-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> Hello World>
> 1234>
>
> qwerty>
> asdfgh>
> zxcvbn>
> 123456>
>
>
//deserialization
myTestClass test;
>
>
//deserialization
myTestClass test;
XmlSerializer mySerializer = new XmlSerializer(typeof(myTestClass));
FileStream myFileStream = new FileStream("c:/mtTestClass.xml",FileMode.Open);
No comments:
Post a Comment