Say I am persisting some application data to a single XML file and I want to use the DataContractSerializer
to create all or most of the elements. So my file might look like:
<?xml version="1.0" encoding="utf-8"?>
<Settings>
<A ... />
<B ... />
</Settings>
(A
and B
are serialized using DCS.)
How would I go about writing this file initially, then how would I overwrite it when the data has changed (e.g. replace the A
element with an updated instance)? What about reading it back and deserializing each element?