Skip to content

Instantly share code, notes, and snippets.

@SumindaD
Created December 27, 2019 12:29
Show Gist options
  • Save SumindaD/4c76293e5472f3523bbf15e6dfc568a6 to your computer and use it in GitHub Desktop.
Save SumindaD/4c76293e5472f3523bbf15e6dfc568a6 to your computer and use it in GitHub Desktop.
/// <summary>
/// Serialize an image byte[] to an XML byte[]
/// </summary>
/// <param name="imageBuffer">Byte[] of the image to be serialized into XML</param>
/// <returns>Byte[] of the XML</returns>
private static byte[] SerializeImageToXML(byte[] imageBuffer)
{
XmlSerializer x = new XmlSerializer(typeof(byte[]));
using (MemoryStream myFileStream = new MemoryStream())
{
x.Serialize(myFileStream, imageBuffer);
return myFileStream.ToArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment