What is the difference between XmlTextWriter and XmlWriter?

不问归期 提交于 2021-02-05 20:52:38

问题


I am looking at these these two classes in C#: XmlTextWriter and XmlWriter. Can anyone explain the difference and tell me where to use which?


回答1:


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

You should always call XmlWriter.Create.

MSDN says:

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.



来源:https://stackoverflow.com/questions/6899427/what-is-the-difference-between-xmltextwriter-and-xmlwriter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!