替代XML序列化 [英] Replacement for XML Serialization

查看:218
本文介绍了替代XML序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用的XmlSerializer 序列化/反序列化的数据结构的持久性代码。我已阅读并在几个地方听说这里在计算器上的的XmlSerializer 是一个或多个:

I have code using XmlSerializer to serialize/deserialize a data structure for persistance. I've read and heard in several places here on StackOverflow that XmlSerializer is one or more of:



  • 支持很差/实施

  • 可能将不支持到未来

我的问题是双重的;是上述任何真实的,如果是的话,有哪些办法?对于我而言,XML工作得非常好,我想保留那么多不变,但一切是开放的变化。

My question is two-fold; is any of the above true, and if so, what alternatives exist? For my purposes, XML works very well, and I would like to keep that much constant, but everything else is open to change.

编辑:如果你想暗示对方XML的东西,我接受它,但它确实需要人类可读的。

If you want to suggest something other to XML, I'm open to it, but it does need to be human-readable.

推荐答案

的XmlSerializer 是完全支持的,但有一些小故障;

XmlSerializer is perfectly supportable, but has some glitches;


  • 相对的慢;但通常这仍然不够快

  • 只支持公共成员;可以是一个痛苦

  • 要求写入访问器列表 - 只是丑陋

  • relatively slow; but usually this is still fast enough
  • only supports public members; can be a pain
  • requires write accessors lists - just ugly

不过,我希望它继续在那里为一个相当长的时间;海事组织,这是的BinaryFormatter 具有的真正的问题(用于持久性时)。

However, I expect it to continue to be there for a considerable time; IMO, it is BinaryFormatter that has the real problems (when used for persistence).

我是非常偏颇的(因为我是作家),但我会选择 protobuf网;使用谷歌的协议缓冲区线格式的二进制序列;速度快,语言/平台,非常小的输出,版本宽容等(和自由,当然)之间进行移植。显然不是XML,但 - 所以不是人类可读

I'm very biased (since I'm the author), but I'd choose protobuf-net; a binary serializer using Google's "protocol buffers" wire format; fast, portable between languages/platforms, very small output, version tolerant, etc (and free, of course). Clearly not xml, though - so not human readable.

这篇关于替代XML序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆