日期:2014-05-18  浏览次数:21299 次

XmlDataDocument被标记为Obsolete,说以后版本将删除,有什么替代的吗?
[Obsolete("XmlDataDocument class will be removed in a future release.")]
  public class XmlDataDocument : XmlDocument

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

------解决方案--------------------
可以用DataTable的ReadXml()与WriteXml()
------解决方案--------------------
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