|
-
Jul 14th, 2005, 08:16 PM
#1
[RESOLVED] xml and dataset/hashtable
i have about 20 key/value pairs that i want to store in an xml file (the key/value pairs store user preferences for my application). would it be best to use a hashtable or a dataset for this? or is there a better way for storing user preferences (without using the registry).
-
Jul 15th, 2005, 01:35 AM
#2
Re: xml and dataset/hashtable
A dataset, because a dataset has the write to xml method which makes life easier for you.
-
Jul 15th, 2005, 01:39 AM
#3
Re: xml and dataset/hashtable
thanks.
im guessing that a dataset also has a read from xml method.
-
Jul 15th, 2005, 01:56 AM
#4
Re: [RESOLVED] xml and dataset/hashtable
-
Jul 15th, 2005, 02:10 AM
#5
Re: [RESOLVED] xml and dataset/hashtable
Not that it really matters for such a small amount of data, but the XML generated for a DataSet will be much more verbose than that for a serialised collection.
Edit:
I also like to create a custom class for my program settings. Each app's settings class is derived from a base class that has a Save method that takes a file path and saves the current instance, and a Shared Load method that takes a file path and deserialises the file to an instance of the class and returns it.
Last edited by jmcilhinney; Jul 15th, 2005 at 02:14 AM.
-
Jul 15th, 2005, 02:39 AM
#6
Re: [RESOLVED] xml and dataset/hashtable
what is a serialised collection?
-
Jul 15th, 2005, 03:04 AM
#7
Re: [RESOLVED] xml and dataset/hashtable
Serialisation is the process of converting an object to a form that can be transmitted in a serial manner. You serialise a .NET object to either a binary or text (XML) format for serial transmission, or storage. When you call WriteXml on a DataSet, you are serialising it. The DataSet class implements ISerializable, so it provides its own serialisation functionality. For classes that don't, you would use an XmlSerializer to serialise and deserialise instances. You can also use binary serialisation, but I've never had the pleasure. Binary serialisation is more efficient, I believe, but XML serialisation has the advantage of producing human-readable results.
-
Jul 15th, 2005, 06:12 AM
#8
Re: [RESOLVED] xml and dataset/hashtable
so i could create a hashtable and serialise it to store the data in an xml file?
-
Jul 15th, 2005, 06:27 AM
#9
Re: [RESOLVED] xml and dataset/hashtable
-
Jul 15th, 2005, 08:00 AM
#10
Re: [RESOLVED] xml and dataset/hashtable
thanks...
great link!
EDIT: stupid forum wont let me give rep points until i spread them around.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|