开发者

Should I serialize .net objects to *file* using SOAPFormatter or XMLFormatter if the files are going to later be used by Unix+PC

开发者 https://www.devze.com 2023-02-08 17:10 出处:网络
I have a desktop app that saves out user data (mostly arrays of numbers) to a file by Serializing an object. This file will later be used to reload user data by Deserialising it.

I have a desktop app that saves out user data (mostly arrays of numbers) to a file by Serializing an object. This file will later be used to reload user data by Deserialising it.

I would also like these files to be user-readable and in some standard structured format. The files will be manually moved around (not tr开发者_JAVA百科ansmitted) and will be read by users on both PCs and Unix machines . Just to clarify - my desktop app will not run in Unix but I'd like the Unix users to be able to write a script to parse the data if they needed.

Is there a good reason to use the Soap formatter rather than XML formatter to do this?


Follow the rule you were taut in Grad schools. When it comes to Platform Independence go with XML


Do not use SOAP Formatter. The XML generated is quite bizarre and pretty unusable - I personally believe it is just a binary serialization but in SOAP.

Use XmlSerializer instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消