Can u demystify the concept of serialization for me pls

Hi.

I read Microsoft doc about serialization, but since I never used it. I didn t understand it well.

What do we need it for in real business. Is it mostly to save data in file formats or what.

Thanks for demystifying the concept for me.

[263 byte] By [R.Tutus] at [2007-12-22]
# 1

serialization allows us to store objects to a file and allowing us to restore the object from file into objects again, as if the application was never closed.

So for example, if we have a collection of objects in an array. Instead of us having to go through each element in the array and then writing down the details for each object, serialization takes care of this for us.

http://msdn2.microsoft.com/en-us/library/system.xml.serialization.aspx

http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.serialize.aspx

It's very useful, and fast, to store objects we have used in our application and to be able to restore them back whenever we like.

hope it helps!

ahmedilyas at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
# 2

Another thing to add is that you can also serialize objects via a stream, so you can serialize it via a network stream, which is pretty cool if you are doing some form of remoting I guess.

ahmedilyas at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
# 3

Hi thanks a lot.

ahmedilyas , u explained to me A technicality which I didn t understand. Can u explain to me first what we need that for in plain english, what s the purpose of streaming and network streaming so that I can understand the technicality of the matter.

Sorry, but the words (serialize and stream are not familiar to me) and the Microsoft technical documents don t explain the purpose, the need behind all this. They go straight to details and how to use the technique assuming the person knows what the stuff is used for.

Sorry about my insisting.

Thanks.

R.Tutus at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
# 4

serialize is a method in the XmlSerializer class, which actually performs serialization of an object to a stream.

A stream is like, how can I put it...some form of backing storage to write data to.

This could be:

  • MemoryStream (data written to/read from in memory)

  • streamwriter (data written to another stream or to a file)

  • networkstream (data which can be sent/recieve from when connected to another application, such as a server/client application)

    So if you wanted to do some remoting, example could be where you want to send a list of items from Server to the client connected to the server application, assuming the client supports serialization, you can serialize these items via the communication stream (network stream for example). This is really cool to do, instead of having your own mechinism of sending and recieving data, finding out which part of the data is which part and so on....there is alot behind this but lets stick to the simple stuff.

    Xml is a big thing and its a way of managing how we use data.

    does this help further?

  • ahmedilyas at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
    # 5

    Serialization is a general computer science concept, not anything Microsoft or Remoting specific. You would probably do best by Live searching this general term. One good result I came up with was the Wikipedia article on the subject (http://en.wikipedia.org/wiki/Serialization). It explains the concept fairly well, with some good background context. You probably don’t need to look at the code examples for all the various languages, but if you are using .NET, then I would suggest going on MSDN (http://msdn2.microsoft.com/en-us/default.aspx) if you want to search for how to serialize things specifically.

    Hope this helps.

    RobbyBryant at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...

    .NET Development

    Site Classified