This documentation is archived and is not being maintained.

XmlWriter.WriteBase64 Method

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

[Visual Basic]
Public MustOverride Sub WriteBase64( _
   ByVal buffer() As Byte, _
   ByVal index As Integer, _
   ByVal count As Integer _
public abstract void WriteBase64(
 byte[] buffer,
 int index,
 int count
public: virtual void WriteBase64(
 unsigned char buffer __gc[],
 int index,
 int count
) = 0;
public abstract function WriteBase64(
   buffer : Byte[],
 index : int,
 count : int


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


Exception Type Condition
ArgumentNullException buffer is a null reference (Nothing in Visual Basic).
ArgumentException The buffer length minus index is less than count.
ArgumentOutOfRangeException index or count is less than zero.


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 .


See XmlTextWriter.WriteBase64 for an example using this method.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

XmlWriter Class | XmlWriter Members | System.Xml Namespace