XmlDictionaryWriter::CreateBinaryWriter Method
Creates an instance of XmlDictionaryWriter that writes WCF binary XML format.
Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | CreateBinaryWriter(Stream^) | Creates an instance of XmlDictionaryWriter that writes WCF binary XML format. |
![]() ![]() | CreateBinaryWriter(Stream^, IXmlDictionary^) | Creates an instance of XmlDictionaryWriter that writes WCF binary XML format. |
![]() ![]() | CreateBinaryWriter(Stream^, IXmlDictionary^, XmlBinaryWriterSession^) | Creates an instance of XmlDictionaryWriter that writes WCF binary XML format. |
![]() ![]() | CreateBinaryWriter(Stream^, IXmlDictionary^, XmlBinaryWriterSession^, Boolean) | Creates an instance of XmlDictionaryWriter that writes WCF binary XML format. |
The binary format only supports one text node as the attribute value and therefore buffers the values written to it to emit a single node, as shown in the following sample code.
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();
In the previous sample the code buffers about 1 GB of memory, while in the other writers it writes the values as they are provided.

