XmlDictionaryWriter.CreateBinaryWriter 方法

定义

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

重载

CreateBinaryWriter(Stream)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

CreateBinaryWriter(Stream, IXmlDictionary)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

注解

该二进制格式仅支持使用一个文本节点作为其属性值,因此将缓冲写入其中的值,以便发出单个节点,如下面的示例代码所示。

XmlWriter binarywriter = XmlDictionaryWriter.CreateBinaryWriter(Stream.Null);  
binarywriter.WriteStartAttribute("StartAttribute");  
string largeStr = new string('r', 100000);  
for (int i = 0; i < 10000; i++)   
{  
    binarywriter.WriteValue(largeStr);  
}  
binarywriter.WriteEndAttribute();  

在前面的示例中,代码会缓冲大约 1 GB 内存,而在其他编写器中,值是在提供的时候写入的。

CreateBinaryWriter(Stream)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

public:
 static System::Xml::XmlDictionaryWriter ^ CreateBinaryWriter(System::IO::Stream ^ stream);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream);
static member CreateBinaryWriter : System.IO.Stream -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateBinaryWriter (stream As Stream) As XmlDictionaryWriter

参数

stream
Stream

要写入的流。

返回

XmlDictionaryWriter

XmlDictionaryWriter 的一个实例。

适用于

CreateBinaryWriter(Stream, IXmlDictionary)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

public:
 static System::Xml::XmlDictionaryWriter ^ CreateBinaryWriter(System::IO::Stream ^ stream, System::Xml::IXmlDictionary ^ dictionary);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream, System.Xml.IXmlDictionary dictionary);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream, System.Xml.IXmlDictionary? dictionary);
static member CreateBinaryWriter : System.IO.Stream * System.Xml.IXmlDictionary -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateBinaryWriter (stream As Stream, dictionary As IXmlDictionary) As XmlDictionaryWriter

参数

stream
Stream

要写入的流。

dictionary
IXmlDictionary

用作共享字典的 XmlDictionary

返回

XmlDictionaryWriter

XmlDictionaryWriter 的一个实例。

适用于

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

public:
 static System::Xml::XmlDictionaryWriter ^ CreateBinaryWriter(System::IO::Stream ^ stream, System::Xml::IXmlDictionary ^ dictionary, System::Xml::XmlBinaryWriterSession ^ session);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlBinaryWriterSession session);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream, System.Xml.IXmlDictionary? dictionary, System.Xml.XmlBinaryWriterSession? session);
static member CreateBinaryWriter : System.IO.Stream * System.Xml.IXmlDictionary * System.Xml.XmlBinaryWriterSession -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateBinaryWriter (stream As Stream, dictionary As IXmlDictionary, session As XmlBinaryWriterSession) As XmlDictionaryWriter

参数

stream
Stream

要写入的流。

dictionary
IXmlDictionary

用作共享字典的 XmlDictionary

返回

XmlDictionaryWriter

XmlDictionaryWriter 的一个实例。

适用于

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean)

创建一个 XmlDictionaryWriter 实例,该实例写入 WCF 二进制 XML 格式。

public:
 static System::Xml::XmlDictionaryWriter ^ CreateBinaryWriter(System::IO::Stream ^ stream, System::Xml::IXmlDictionary ^ dictionary, System::Xml::XmlBinaryWriterSession ^ session, bool ownsStream);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlBinaryWriterSession session, bool ownsStream);
public static System.Xml.XmlDictionaryWriter CreateBinaryWriter (System.IO.Stream stream, System.Xml.IXmlDictionary? dictionary, System.Xml.XmlBinaryWriterSession? session, bool ownsStream);
static member CreateBinaryWriter : System.IO.Stream * System.Xml.IXmlDictionary * System.Xml.XmlBinaryWriterSession * bool -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateBinaryWriter (stream As Stream, dictionary As IXmlDictionary, session As XmlBinaryWriterSession, ownsStream As Boolean) As XmlDictionaryWriter

参数

stream
Stream

要从其中读取数据的流。

dictionary
IXmlDictionary

用作共享字典的 XmlDictionary

ownsStream
Boolean

如果指示完成时编写器关闭流,则为 true;否则为 false

返回

XmlDictionaryWriter

XmlDictionaryWriter 的一个实例。

适用于