.net – XMLWriter vs XMLDictionaryWriter

前端之家收集整理的这篇文章主要介绍了.net – XMLWriter vs XMLDictionaryWriter前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
XMLWriter和XMLDictionaryWriter有什么区别?在哪种情况下,每种情况通常使用?
XmlWriter是一个抽象类,其中XmlDictionaryWriter是继承自己的类之一,它本身就是一个抽象类.

我正在黑暗中采取一种刺激,您希望使用DataContractSerializer或通常使用de / serialization. XmlDictionaryWriter是WCF使用它进行de / serialization的基类.

从那里我将推断,在XmlDictionaryWriter中必须有一些性能调优,以使其在WCF de / serialization任务中更具性能.事实上,如果你调用WriteObject(Stream,object)而不是WriteObject(XmlWriter,object)或WriteObject(XmlDictionaryWriter,object)方法,它将为你创建一个XmlDictionaryWriter

public virtual void WriteObject(Stream stream,object graph)
{
    CheckNull(stream,"stream");
    XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(stream,Encoding.UTF8,false);
    this.WriteObject(writer,graph);
    writer.Flush();
}
原文链接:https://www.f2er.com/xml/292906.html

猜你在找的XML相关文章