I have a project where the data is arriving from the network (not a database) and has it’s own parsing peculiarities.
The parsing process stores the data in a array of objects of a class that is full of Public Property.
This class and it’s array is used as an object data source to a BindingSource that shows the values as a nice table in a DataGridView on the screen.
Now I need to save this data to disk (and be able in a later moment to retrieve it back to be sent back to the network).
I’ve worked before with DataSet saving to XML and it’s a breeze to implement, but this one is puzzling me.
All this information is already in the code, so I don’t think I should be typing line by line, each one of the properties to be able to save it.
I’ve been trying without success some way to get the data out of the binder to a new DataSet so I can use the XML method, or some way to get from the binder to disk, or even directly access the DataSource objects.
I really don’t care if even it’s readable as a plain text in disk, as long as I can read it back to the DataSource objects at a later point.
any ideas how to accomplish that?
Why not just use a XmlSerializer to save your object?
Example:
Resulting file content: