To use this code simply A) reference the assembly in the source code zip called JerrodSoft.dll or B) load this project in a solution and do the following:

Steps to using XmlSerializer:
1) Instantiate instance of object XmlSerializer
* var serializer = new XmlSerializer();
2) To serialize an object you have created you can call <instance>.Serialize(object). This will turn the object you want to serialize into a valid XML string.
* var serializer = new XmlSerializer();
* string myString = serializer.Serialize(SomeObjectYouWantSerialized);
3) To deserialize xml you can call <instance>.DeSerialize(string, type) which will return you an object which you will need to case or you can call <instance>.DeSerialize<T>(string) which will deserialize the sttring into a strongly typed object of type T for you.
* var serializer = new XmlSerializer();
* MyObject x = serializer.DeSerialize(XmlTextCreated, typeof(MyObject)) as MyObject;
* -- or --
* MyObject x = serializer.DeSerialize<MyObject>(XmlTextCreated);

Currently the XSD generator can only serialize one class at a time, but enhancements are coming soon.
Steps to using XsdSerializer:
1) Instantiate instance of object XsdSerializer
2) call XsdSerializer.Serialize(object) to return xsd string.
3) Do what you will with the string.

Last edited Oct 13, 2012 at 3:21 PM by DotNetRockStar, version 7


No comments yet.