本文介绍了XmlTextWriter 和 XmlWriter 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 C# 中查看这两个类:XmlTextWriterXmlWriter.谁能解释一下区别并告诉我在哪里使用哪个?

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?

推荐答案

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 编写器.

这篇关于XmlTextWriter 和 XmlWriter 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 23:40
查看更多