What you really need is Data Contract: http://msdn.microsoft.com/en-us/library/ms733127.aspx
Please see my past answers advocating this approach:
How can I utilize XML File streamwriter and reader in my form application?
Creating property files...
This is much better then the solution referenced in Solution 1. The difference is performance
. Data Contract serializer does the reflection only once per type. It creates a serialization assembly on the fly, using
. If you wanted to develop similar solution by yourself, you would face with the need to know CIL very well, and Emit code is quite difficult to debug.