XmlTextWriter 和 XmlWriter 有什么区别? [英] What is the difference between XmlTextWriter and XmlWriter?

查看:46
本文介绍了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 编写器.

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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆