Redigeeri

Jagamisviis:


XmlDictionaryWriter.CreateBinaryWriter Method

Definition

Creates an instance of XmlDictionaryWriter that writes WCF binary XML format.

Overloads

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.

Remarks

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.

CreateBinaryWriter(Stream)

Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs

Creates an instance of XmlDictionaryWriter that writes WCF binary XML format.

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

Parameters

stream
Stream

The stream to write to.

Returns

An instance of XmlDictionaryWriter.

Applies to

CreateBinaryWriter(Stream, IXmlDictionary)

Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs

Creates an instance of XmlDictionaryWriter that writes WCF binary XML format.

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

Parameters

stream
Stream

The stream to write to.

dictionary
IXmlDictionary

The XmlDictionary to use as the shared dictionary.

Returns

An instance of XmlDictionaryWriter.

Applies to

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession)

Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs

Creates an instance of XmlDictionaryWriter that writes WCF binary XML format.

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

Parameters

stream
Stream

The stream to write to.

dictionary
IXmlDictionary

The XmlDictionary to use as the shared dictionary.

Returns

An instance of XmlDictionaryWriter.

Applies to

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean)

Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs
Source:
XmlDictionaryWriter.cs

Creates an instance of XmlDictionaryWriter that writes WCF binary XML format.

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

Parameters

stream
Stream

The stream from which to read.

dictionary
IXmlDictionary

The XmlDictionary to use as the shared dictionary.

ownsStream
Boolean

true to indicate that the stream is closed by the writer when done; otherwise false.

Returns

An instance of XmlDictionaryWriter.

Applies to