+ -
当前位置:首页 → 问答吧 → XmlDataDocument被标记为Obsolete,说以后版本将删除,有什么替代的吗?

XmlDataDocument被标记为Obsolete,说以后版本将删除,有什么替代的吗?

时间:2011-12-28

来源:互联网

[Obsolete("XmlDataDocument class will be removed in a future release.")]
  public class XmlDataDocument : XmlDocument

由于DataSet直接读xml会丢失空格,目前用这个类来做xml到DataSet的转换。这个类标记成Obsolete,为什么没有替代品呢,一般Obsolete标记里会说被替换成什么什么吧

作者: phommy   发布时间: 2011-12-28

可以用DataTable的ReadXml()与WriteXml()

作者: avon520   发布时间: 2011-12-28

XDocument

The XmlDataDocument class, which was supposed to allow one to treat DataSet objects as if they were XML DOM objects has been marked. While it is hard to think of a real use case for this functionality, one could still achieve it by combining DataSet.WriteXml with the much easier to use XDocument class.

http://www.infoq.com/news/2010/03/Obsolete-CLR4

作者: Sandy945   发布时间: 2011-12-28