Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have a need to deserialize an XML file which contains an image in base64 string. When I deserialize the XML the image is straight away populated as bytes by the following class. Which pretty much eliminates the need to do anything fancy and I write the image from those bytes. However a few images print as corrupt while others are perfectly fine. I need to resolve why few images are corrupt. Either the source is incorrect or I am missing something.

My question is 'is it necessary to use
Convert.FromBase64String()
function to convert the base64 string to bytes?' Doing this doesn't really make a difference anyway.

I suppose that the XML deserialization process automatically does that job

Can anybody please provide a credible source for whatever the case maybe?
Public Class Graphics_Data
  Private _Image_Graphic As List(Of Byte())
  <XmlElement("Image_Graphic")>
  Public Property Image_Graphic As List(Of Byte())
    Get
        Return _Image_Graphic
    End Get
    Set(value As List(Of Byte()))
        _Image_Graphic = value
    End Set
 End Property
End Class
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900