|
-
Aug 29th, 2010, 07:25 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] XML settings and data
Hi!
In your opinion what's the best way to write and read to a XML file if you want to insert random data to the file, like settings, and later on change, add or delete some of that data?
By best way I mean simple and few lines of code.
-
Aug 29th, 2010, 07:48 PM
#2
Re: XML settings and data
For settings, I go with My.Settings ... it doesn't get much simpler than that.
Or, if you need something a bit more flexible but simple... store everythign in a class and (de)serialize it... only takes a couple lines of code, and once you make a method out of it, it's just as easy to use as My.Settings.
-tg
-
Aug 29th, 2010, 08:00 PM
#3
Thread Starter
Fanatic Member
Re: XML settings and data
My.Settings is very nice, but doesn't allow to add new settings in runtime.
Serializing/deserializing a class is very limited. If I want to serialize two different classes to the same XML I would need some kind of a workarround, like putting the 2 classes in another class. Well you see how messy that gets.
Isn't there anyway neater?
-
Aug 30th, 2010, 11:34 AM
#4
Thread Starter
Fanatic Member
Re: XML settings and data
Found the solution here. LINQ to XML is very neat and easy to use.
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
|