Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

XML Serialization | Storing Settings - .NET

I have just written a quick example on using XML serialization to create a configuration / settings file to interact with your application in VB in order to store user settings. This blows my.settings out the window in my opinion, but they both come in useful for different purposes. I however always use XML no matter what I am doing.

The example project I have created to demonstrate the use and process of XML is poor. I did not even give a thought to the interface or provide other controls, but I hope people can learn from this.

Any questions, just pm me or reply here.

Demonstration:

[Image: 1WplNTM.gif]

Source Code / Project:
Code
https://www.sendspace.com/file/dycumv
You do know that the built in Project Settings uses xml?
The only downside of it is that if the location of the executable is changed, it is treated as a new program, so it creates a new settings file.

Anyways, your settings file is hardcoded for the things you have in your project, which it shouldn't be. Not to mention it only allows string values

To say that this blows the built in settings out of the water isn't true.

Take this post as an initiative to improve it!
[Image: jlscvfi.png]
It does blow it out the water (for me) and here are my reasons why.

1) As you said once the exe location is changed, it creates a new settings file, so previous settings are lost.
2) You can't work with plugins using my.settings, because it only writes one file. If you use XML serialization independently you can create as much plugins as you wish and have the program read any of them.

Please evaluate further on what you have said. I like to learn.

By the way, this is just an example. I was hoping someone would come here and tell me a better way of doing this. This is in no way dynamic and wasn't supposed to be. However I may make a dynamic one in my free time

Thanks
few points
just for xml > Runtime.Serialization.Formatters.Binary.BinaryFormatter
just for string > Dictionary(Of String, Object)
Does anyone have idbs old serialization example? I always wanted to check that out but the links are dead
(Jul 17, 2014 04:48 AM)Cairns Wrote:  Does anyone have idbs old serialization example? I always wanted to check that out but the links are dead

Lol, you have him on Skype. Message him regarding it.
[Image: 1zL3pDG.jpg]
Idb no longer has that otherwise I wouldn't have posted regarding it. All right guys, chill. It's only an example lol if you can do much better than why not post it. As I said I love to learn, and so does some other members here.
I much much prefer this method of storing information over using My.Settings. Mainly because I've had several projects where the user wanted to have different settings for different profiles (think Firefox). This way of doing things just gives more flexibility.
Need a custom software? Check out my freelance service here! 6+ years and counting, never a complaint :)

STOP STEALING CODE.

FREE NATHAN

People who report posts are lamers.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 218 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[C#] by zxPhantomBladeNov 16, 2020 03:05 AM 4 198 Nov 16, 2020 03:05 AM
Last Post: zxPhantomBlade
[Shell] by Emre_Sep 4, 2019 03:15 PM 0 146 Sep 4, 2019 03:15 PM
Last Post: Emre_