Q&A for Work. Setup a private space for you and your coworkers to ask questions and share information. Learn more about Teams. List, serialize. A List can be serialized to the disk. We want to serialize (to a file) a List of objects. The next time the program runs, we get this List straight from the disk. We see an example of BinaryFormatter and its Serialize methods.List.
Autocad batch plot script. I have an object list and wanna serialize it to xml. My object is:
And here i make my list just like this:
And i send this list to a method which will serialize my object:
And my method is:
In this method; i use pugixml library for serialization. Because of non-reflection language c++, i had to do this to serialize my object. Here is my old question:How to change or delete tags in boost serialization? And my object header like this:
This struct can serialize object to xml successfully. Just for clear, here my example:
C# Serialize To Xml
if i serialize this pingLog object: saver(_doc.root(), 'PingLog', pingLog);
print will be like this:
My question is, when i serialize an array i got xml tags for each object. Here an example xml print:
How can i fix this, what is my fault?
if anyone would have a problem like this; here is my solution:
i have just added another struct thanks to @Scheff who is my mentor now.
My new Xml Saver is like this:
And my new struct is:
I'm using this struct like this:
The only problem is in the xml we have an unnecessary tag ' thats why i had to change my server side code too.
Anyway thank you for your comments and support.
If you are able to add some small modification into structure, and you have C++ 11. You can try my lib, can be found at https://github.com/incoder1/IO:
C# Serialize Xml To Object
An example for you case:
C# Serialize Class To Xml
And the result: