LINQ to SQL equivalent for XML file persistence
Microsoft has made saving objects very easy with their LINQ to SQL mapping.
However, I would sometimes like something a little more lightweight, i.e. th开发者_开发问答e ability to save objects to a file when an application closes, and read them back in again. XML seems like a natural data format rather than inventing a new data format. (Of course, one could argue that XML is the new ascii, and we still have the problem of defining the data schema etc. ..).
Is there a predefined method of doing this, or am I going to have to manually figure out an XML data format and write routines to read/write them, i.e. by constructing a DOM equivalent and then saving as XML?
How about working with your data in DataSets and DataTables, etc - then serializing them as XML?
精彩评论