public WriteBase64 ( byte buffer, int index, int count ) : void | ||
buffer | byte | |
index | int | |
count | int | |
return | void |
byte[] data = File.ReadAllBytes("image.png"); XmlTextWriter writer = new XmlTextWriter("output.xml", Encoding.UTF8); writer.WriteBase64(data, 0, data.Length); writer.Close();
MemoryStream stream = new MemoryStream(); byte[] data = { 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74 }; XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8); writer.WriteBase64(data, 0, 6); writer.Close(); string xml = Encoding.UTF8.GetString(stream.ToArray()); Console.WriteLine(xml);This example creates a MemoryStream and writes a byte array to it using WriteBase64. The resulting XML is then converted to a string and printed to the console. The System.Xml assembly contains the classes for working with XML in .NET.
public WriteBase64 ( byte buffer, int index, int count ) : void | ||
buffer | byte | |
index | int | |
count | int | |
return | void |