Comparteix a través de


XmlDictionaryWriter.CreateBinaryWriter Método

Definición

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

Sobrecargas

CreateBinaryWriter(Stream)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

CreateBinaryWriter(Stream, IXmlDictionary)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

Comentarios

El formato binario solo admite un nodo de texto como valor de atributo y por consiguiente almacena en búfer los valores escritos en él para emitir un nodo único, como se muestra en el código de muestra siguiente.

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();  

En el ejemplo anterior el código almacena en búfer aproximadamente 1 GB de memoria, mientras que en los otros sistemas de escritura escribe los valores como se proporcionan.

CreateBinaryWriter(Stream)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

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

Parámetros

stream
Stream

Secuencia en la que se va a escribir.

Devoluciones

XmlDictionaryWriter

Instancia de XmlDictionaryWriter.

Se aplica a

CreateBinaryWriter(Stream, IXmlDictionary)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

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

Parámetros

stream
Stream

Secuencia en la que se va a escribir.

dictionary
IXmlDictionary

XmlDictionary que se va a utilizar como diccionario compartido.

Devoluciones

XmlDictionaryWriter

Instancia de XmlDictionaryWriter.

Se aplica a

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

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

Parámetros

stream
Stream

Secuencia en la que se va a escribir.

dictionary
IXmlDictionary

XmlDictionary que se va a utilizar como diccionario compartido.

session
XmlBinaryWriterSession

Objeto XmlBinaryWriterSession que se va a usar.

Devoluciones

XmlDictionaryWriter

Instancia de XmlDictionaryWriter.

Se aplica a

CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean)

Crea una instancia de XmlDictionaryWriter que escribe el formato XML binario WCF.

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

Parámetros

stream
Stream

Secuencia a partir de la cual se lee.

dictionary
IXmlDictionary

XmlDictionary que se va a utilizar como diccionario compartido.

session
XmlBinaryWriterSession

Objeto XmlBinaryWriterSession que se va a usar.

ownsStream
Boolean

Si es true para indicar que el sistema de escritura cerrará el flujo cuando haya terminado; de lo contrario, false.

Devoluciones

XmlDictionaryWriter

Instancia de XmlDictionaryWriter.

Se aplica a