Friday, April 3, 2015

When you make a C# partial class dance partner for an XSD with Xsd2Code++ you must explictly turn on the serialize/deserialize stuff.

Otherwise you will not end up with methods for serializing and deserializing at the partial code. When you see the xsd2code++ Version 4.0.0.392 dialog box, you may expand "Serialization" at the "Options" tab at the right to find the switch for "Enabled" which needs to be set to "True" for the methods to be built out. If a string called blobOfGunk contained a serialization of Foo you could deserialize like so:

Foo foo = new Foo();
Exception exception = new Exception();
bool isDeserialized = Foo.Deserialize(blobOfGunk, out foo, out exception);

 
 

...and also turn back around and reserialize like this:

string serialization = foo.Serialize();

No comments:

Post a Comment