简体   繁体   English

XmlTextWriter和XmlWriter有什么区别?

[英]What is the difference between XmlTextWriter and XmlWriter?

I am looking at these these two classes in C#: XmlTextWriter and XmlWriter . 我在C#中查看这两个类: XmlTextWriterXmlWriter Can anyone explain the difference and tell me where to use which? 任何人都可以解释差异并告诉我在哪里使用哪个?

XmlWriter is an abstract class. XmlWriter是一个抽象类。
XmlTextWriter is a specific implementation of XmlWriter . XmlTextWriterXmlWriter的特定实现。

You should always call XmlWriter.Create . 你应该总是调用XmlWriter.Create

MSDN says: MSDN说:

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. 在.NET Framework 2.0版中,建议的做法是使用XmlWriter.Create方法和XmlWriterSettings类创建XmlWriter实例。 This allows you to take full advantage of all the new features introduced in this release. 这使您可以充分利用此版本中引入的所有新功能。 For more information, see Creating XML Writers . 有关更多信息,请参阅创建XML Writer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM