XmlDictionaryWriter.CreateBinaryWriter 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。
多載
CreateBinaryWriter(Stream) |
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。 |
CreateBinaryWriter(Stream, IXmlDictionary) |
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。 |
CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession) |
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。 |
CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean) |
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。 |
備註
二進位格式僅支援一個當做屬性值的文字節點,因此會緩衝處理寫入至其中的值來發出單一節點,如下列範例程式碼所示。
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)
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。
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 的執行個體。
適用於
CreateBinaryWriter(Stream, IXmlDictionary)
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。
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 的執行個體。
適用於
CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession)
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。
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。
- session
- XmlBinaryWriterSession
要使用的 XmlBinaryWriterSession。
傳回
XmlDictionaryWriter 的執行個體。
適用於
CreateBinaryWriter(Stream, IXmlDictionary, XmlBinaryWriterSession, Boolean)
建立寫入 WCF 二進位 XML 格式的 XmlDictionaryWriter 執行個體。
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。
- session
- XmlBinaryWriterSession
要使用的 XmlBinaryWriterSession。
- ownsStream
- Boolean
true
表示寫入器會在完成時關閉資料流;否則為 false
。
傳回
XmlDictionaryWriter 的執行個體。