Re: serializable
Peter Osucha <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
Hmmm, I achieved what I wanted by marking the property {get/set} with the
[XmlIgnore] attribute instead of the [NonSerializable()] attribute. I guess
I don't understand what the [NonSerializable()] attribute is for...
Peter
-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:[email protected]] On Behalf Of Peter Osucha
Sent: Wednesday, July 26, 2006 4:49 PM
To: [email protected]
Subject: [DOTNET-CX] serializable
I want to use one or two small xml files to persist some very basic
applications settings and it seems that using xml files will probably be a
better solution than my old way of using the registry.
I am not well versed in XML. I spent a few hours looking through the Help
system to learn more about reading and writing XML stuff - it seems that NET
does a very solid job supporting such functionality. Anyway, when reviewing
the XmlWriter and XmlReader classes, I stumbled on the 'serializable'
attribute - which will make some of this persistence even easier.
The problem I'm having is marking some things non-serializable and the Help
system isn't helping me out here.
In one main object I want to serialize, I have a field for an application
password. The object has properties to return this password in an encrypted
form and an unencrypted form - although there is only one private variable
holding the password. So if I'm not mistaken, if I want to just mark the
class serializable, then I need to create private variables for the
encrypted password and the unencrypted password and mark the encrypted one
as [NonSerializable()]. Is this correct? Is there a 'better' way (I
haven't really looked at implementing ISerializable yet).
Peter
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com