Serialization in dotnet the easy way

Many times I have been asked , “how can I easily serialize my objects in .net to xml representation or to JSON objects to be injected or called from client side.” Well there is surely a lot of ways to skin a cat but my little sample shows you how to do it very easy using generics.

Usually when you work with serialized objects in some form of string representation , the difficulty comes in with encoding of character so that the data can actually get interpreted correctly, or formatting especially in things like dates (this is to ensure that they can be parsed). In my sample I have created a simple console App that shows how the serialization methods are created using generics and the .net contract serializer.

[ Download the Code ]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s