What is the difference between XmlTextWriter and XmlWriter?

后端 未结 1 1446
广开言路
广开言路 2021-02-03 21:50

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条回答
  • 2021-02-03 22:36

    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.

    0 讨论(0)
提交回复
热议问题