System.Xml.XmlWriter.WriteBase64 Method

When overridden in a derived class, encodes the specified binary bytes as Base64 and writes out the resulting text.

Syntax

public abstract void WriteBase64 (byte[] buffer, int index, int count)

Parameters

buffer
Byte array to encode.
index
The position in the buffer indicating the start of the bytes to write.
count
The number of bytes to write.

Exceptions

TypeReason
ArgumentNullException buffer is null.
ArgumentExceptionThe buffer length minus index is less than count.
ArgumentOutOfRangeException index or count is less than zero.
InvalidOperationExceptionThe XmlWriter.WriteState is WriteState.Closed.

Remarks

For example, the byte buffer may contain the binary contents of a GIF image. This clearly would not be valid XML. The Base64 encoding is designed to represent arbitrary byte sequences in a text form comprised of the 65 US-ASCII characters ([A-Za-z0-9+/=]) where each character encodes 6 bits of the binary data. For more information, see Requests for Comments (RFC) 1521 located on the Request for Comments Web site at http://www.rfc-editor.org/.

For the asynchronous version of this method, see XmlWriter.WriteBase64Async(Byte[], int, int).

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0