且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

XmlTextWriter 和 XmlWriter 有什么区别?

更新时间:2022-06-18 22:52:00

XmlWriter 是一个抽象类.
XmlTextWriterXmlWriter 的具体实现.

XmlWriter is an abstract class.
XmlTextWriter is a specific implementation of XmlWriter.

你应该总是调用 XmlWriter.Create.

MSDN 说:

在 .NET Framework 2.0 版本中,推荐的做法是使用 XmlWriter.Create 方法创建 XmlWriter 实例和XmlWriterSettings 类.这使您可以充分利用此版本中引入的所有新功能.想要查询更多的信息,请参阅创建 XML 编写器.

In the .NET Framework version 2.0 release, the recommended practice is to create XmlWriter instances using the XmlWriter.Create method and the XmlWriterSettings class. This allows you to take full advantage of all the new features introduced in this release. For more information, see Creating XML Writers.