I have an object such as the following
Public Class Item
Public Property Description As String
<XmlIgnore>
Public Property Picture As Bitmap = My.Resources.no_image
<XmlElement(ElementName:="Picture")>
<Browsable(False)>
Public Property _pic As String
Get
Return ImageToString(Me.Picture)
End Get
Set
Picture = StringToImage(Value)
End Set
End Property
Public Property Location As String
Public Property Price As Single
Public Property Status As String
End Class
This object is intended to be displayed in a DataGridView
within winforms, but I would like to also be able to serialze it to XML, using XmlSerializer
. I have implemented two functions that convert a bitmap to a base64 string and back.
Where I ran in to trouble is coming up with a way to alter the serilazation process of the Bitmap class, as it is not inheritable, and the above solution has not achieved the desired result.
How would I go about fixing this?