Re: Object Serialization
- From: "Rodrigo Defavari" <rodrigo.defavari@xxxxxxxxx>
- Date: Fri, 8 Feb 2008 13:44:47 -0200
Hello Phill W.
In my case, the user will have access the properties through component
PropertyGrid to personalize the controls and also to create new. For this
reason I wanted to save all the properties.
I didn't understand that part of the code that you passed me:
Private Sub SaveTo( ele as XmlElement ) _
Implements IPortable.SaveTo
' Add Xml elements/attributes
End Sub
What does the line ' Add Xml elements/attributes mean?
Sorry, my english is very bad!!! :(
Rodrigo Defavari
"Phill W." <p-.-a-.-w-a-r-d-@xxxxxxxxxxxxxxxxxxxx> escreveu na mensagem
news:fohjps$55n$1@xxxxxxxxxxxxxxxxxxxx
Rodrigo Defavari wrote:
To exemplify better: I am needing to save in a XML file all the
properties of a control as button, textbox, checkbox, etc..
Serialisation will save /every/ property on the control. Think about just
how many properties, say, a TextBox has and you'll be looking at a /lot/
of data.
Question: do you need /all/ of these values?
Look at the properties that you're actually /changing/ in your application
and add a method that will allow you to save /just/ those.
Then add another method to read this data back and configure an equivalent
control using the same parameters.
Interface IPortable
Sub SaveTo( ele as XmlElement )
Sub ReloadFrom( ele as XmlElement )
End Interface
Class PortableTextBox
Inherits TextBox
Implements IPortable
Private Sub SaveTo( ele as XmlElement ) _
Implements IPortable.SaveTo
' Add Xml elements/attributes
End Sub
Private Sub ReloadFrom( ele as XmlElement ) _
Implements IPortable.ReloadFrom
' Set properties from Xml elements/attributes
End Sub
End Class
Lastly, if this "serialised" data is being saved /anywhere/ outside your
program, make sure you include a "version number" in it somewhere, so that
the ReloadFrom() routine can cater for changes that you might make over
time.
HTH,
Phill W.
.
- Follow-Ups:
- Re: Object Serialization
- From: Phill W.
- Re: Object Serialization
- References:
- Object Serialization
- From: Rodrigo Defavari
- Re: Object Serialization
- From: Phill W.
- Object Serialization
- Prev by Date: Re: Command line interface and Windows form in same program
- Next by Date: Re: Command line interface and Windows form in same program
- Previous by thread: Re: Object Serialization
- Next by thread: Re: Object Serialization
- Index(es):