Why Do we need Serialization?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raakhiparimkayala
    New Member
    • Aug 2010
    • 4

    #1

    Why Do we need Serialization?

    Hi there, just digging into serialization a few questions about serialization.
    1. Why do we need serialization?
    Ans: For transferring the objects or saving the objects in database or file etc.
    But why to serialize inorder to transfer the file? We can directly transfer the file if we create the class in separate .cs file and directly send the file to the person required.

    2. Where do we implement serialization?
    Ans: Remoting
    Can any one please give me remoting examples? Coz I am learning everything by my own and require some assistance to learn few things.

    Any help is much appreciated. Thanks in advance.
    Rakesh.
    Last edited by Niheel; Aug 24 '10, 06:25 PM.
  • Joseph Martell
    Recognized Expert New Member
    • Jan 2010
    • 198

    #2
    I think you may be misunderstandin g the answer to question 1. Serialization is for the transfer of objects, not classes. Source files only hold the class definitions, not actual objects. Serialization provides us a method for transferring instantiated objects from one location to another.

    A real-life example of remoting involves accessing restricted resources. If there are 2 servers in a network, one which has access to a specific resource (a file, database, etc.) and the other would like information stored on that resource but lacks access, remoting can provide an amicable solution. An object can be instantiated on the server with access and a proxy can be created on the server that wants information. Commands and information from the proxy are serialized and sent to the remote object where they are executed. The return information is serialized and sent back to the proxy object.

    Serialization can also be used as a way to store an object in a particular state and then restore that object to the same state later. This can be useful to store complex objects and between program executions.

    Comment

    • raakhiparimkayala
      New Member
      • Aug 2010
      • 4

      #3
      Thank you very much. You are a life save

      Hi Joseph,
      Thank you verymuch for correcting my mistake. I was under the wrong impression that serialization is meant for classes. Not the objects. Thank you once again for correcting me.

      Thanks
      Rakesh

      Comment

      Working...