I am saving some small images to Xml as a Byte[] via the following XElement construct..
XElement xe = new XElement('Images', from c in qry select new XElement('Image', new XAttribute('Date', c.Date), new XElement('Data', c.Bytes)));
the Bytes property is a Byte[], looking at the resulting element the contents of the array appear to be saved just peachy.
My problem is I can’t seem to read this back simply. What is the best way to retrieve this element? Typecasting to a Byte[] appears to be not allowed, am I really going to have to read this as a string? Figure out what encoding to use and convert? Seems to me that given that XElement understood how to write the array, it should be able to read it as well.
I would think about Base64 encoding the byte array. It should be fairly easy to encode/decode this from/to a byte array.