Visual Studio 2010!

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT
ADVERTISEMENT

 

DevSource.com: Your Source for Visual Studio on Facebook
ADVERTISEMENT
Serialization: the What and the Why
By Peter Aitken

Rate This Article: Add This Article To:

Serialization: the What and the Why
( Page 1 of 3 )

The .Net Framework's support for serialization is one of the biggest programming time-savers around. But too few developers understand what it is, or how it can help them.

You hear and see the word serialization a lot in documentation and discussions about .Net. I have found, however, that quite a few programmers do not really understand what serialization is, or why you would use it.

To be honest, I did not have much of a clue for a while. Then I ran up against a development problem that required serialization, but because I did not understand its purpose, I could not use it. It took me a while to get clued in, and now I want to pass this useful information along to other .Net programmers.

Serialization is something you do with objects, and we all know that .Net programming and the Framework are heavily based on objects. In a nutshell, to serialize an object means to convert it to a data format that can be easily saved or transmitted. The most common uses for serialization are to persist an object (in other words, to save it for later use), to share an object between two applications, and to make an object available over an Internet connection. The term serial comes from the fact that these tasks all require that the object be converted to a form that can be sent as a serial data flow — that is, a stream of bytes. After all, this is how disk storage and network connections operate.

Once an object has been serialized it can be deserialized. The result is a copy of the original object. And that is precisely the purpose of serialization.

.Net supports serialization through classes in the Framework. You have two kinds of serialization at your disposal: binary and XML. We will look at both of these.



 
 
>>> More ASP and .Net Coding Techniques Articles          >>> More By Peter Aitken