8 Mar 2013

Xml: Another Way to Use Configuration Options

Many developers believe, a good way to save configuration, can save another line of code. So do I, do not like complicated code to just saving a configuration options for an application that I’ve made. Can’t say how many methods out there to save configuration options, as this is not limited to creativity of each person.

E014584

I do have one way, which is simple enough for me to save any type of configuration with almost any kind of data type. Xml is one of the many options and to do that we just need 2 methods, serialize and deserialize.

Serialize

Serialize is one of the method that we can use to convert an object into readable Xml representation for transportation. Typically transportation methods are done by code. A MSDN documentation about serialization of Xml into an object can be found in this link: http://msdn.microsoft.com/en-us/library/szzyf24s.aspx.

Deserialize

While deserialize works the opposite way, method that we can use to convert an Xml into an object which can be readable from code. A MSDN documentation about deserialization of Xml from an object can be found in this link : http://msdn.microsoft.com/en-us/library/fa420a9y.aspx.

 

What you must do, typically is the same. Define the object, write a serializer or deserializer code, and the last is use the object / xml to your needs. But writing a serializer / deserializer code sometimes is not easy enough to remember. So I decided to write a small class which has 2 main method, Deserialize and Serialize.

How to do that, first you must add reference to Rdz.dll which you can download at http://rdz.codeplex.com, and you can get the documentation at https://rdz.codeplex.com/wikipage?title=CommonXmlSerializer&referringTitle=Documentation. This is my first published project, and hope it helps.

Tidak ada komentar:

Posting Komentar

[give me your ideas, hopes, comments and compliments below...]
[aaand...... +1 if you need to....]