How to use Serialization.

Discussion in 'ASP .Net Web Services' started by Sangeetha Nagaraj, Jul 16, 2004.

  1. I am developing a project for a courier service. My Manager suggested to use serialization.
    I dont know anything about serialization in VB.NET. Can anyone give me some details about Serialization and how to use it practically...
    --
    Rgds,
    Sang
     
    Sangeetha Nagaraj, Jul 16, 2004
    #1
    1. Advertising

  2. Sangeetha Nagaraj

    John Paul. A Guest

    Hi Sang,
    Youe manager has given a good suggestion. Here's the details.

    Serialization is the process by which objects or values are converted into a format that can be persisted or transported. Serialization allows you to save the state of objects from memory to a storage medium such as files. You can also use serialization to transport objects and values across the network. To read the state of the objects or values that you persist or transport using serialization, you use another process called deserialization. Deserialization is complementary to serialization. The .NET Framework supports two types of serialization, binary serialization and XML serialization.

    Binary serialization converts the state of an object by writing the public and private fields, name of the class, and the assembly containing the class into a stream of bytes. To make your objects serializable, you need to mark the class with the Serializable attribute.

    For more details.. See this...

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/objserializ.asp

    http://www.15seconds.com/issue/020903.htm


    --
    Thanks & Regards,
    John Paul. A
    MCP


    "Sangeetha Nagaraj" wrote:

    > I am developing a project for a courier service. My Manager suggested to use serialization.
    > I dont know anything about serialization in VB.NET. Can anyone give me some details about Serialization and how to use it practically...
    > --
    > Rgds,
    > Sang
     
    John Paul. A, Jul 16, 2004
    #2
    1. Advertising

  3. Sangeetha Nagaraj

    John Paul. A Guest

    Here's a sample and a simple code, you asked..

    Imports System.IO
    Imports System.Runtime.Serialization.Formatters.Binary

    Public Class SerializeDemo
    Public Shared Sub Main()
    Dim obj as New MySerializableClass()
    obj.n1 = 10
    obj.s1 = "Hello"
    Dim stream As New FileStream("MyFile.dat", FileMode.Create)
    Dim formatter As New BinaryFormatter()
    formatter.Serialize(stream, obj)
    End Sub
    End Class


    ==========


    Imports System.IO
    Imports System.Xml.Serialization

    Public Class SerializeDemo
    Public Shared Sub Main()
    Dim obj As New MySerializableClass()
    obj.n1 = 10
    obj.s1 = "Hello"
    Dim stream As New FileStream("MyFile.xml", FileMode.Create)
    Dim formatter As New XmlSerializer(GetType(MySerializableClass))
    formatter.Serialize(stream, obj)
    End Sub
    End Class


    --
    Thanks & Regards,
    John Paul. A
    MCP


    "Sangeetha Nagaraj" wrote:

    > The links are really useful.
    > Can you give me a sample and a simple code.
    > --
    > Rgds,
    > Sang
    >
    >
    > "John Paul. A" wrote:
    >
    > > Hi Sang,
    > > Youe manager has given a good suggestion. Here's the details.
    > >
    > > Serialization is the process by which objects or values are converted into a format that can be persisted or transported. Serialization allows you to save the state of objects from memory to a storage medium such as files. You can also use serialization to transport objects and values across the network. To read the state of the objects or values that you persist or transport using serialization, you use another process called deserialization. Deserialization is complementary to serialization. The .NET Framework supports two types of serialization, binary serialization and XML serialization.
    > >
    > > Binary serialization converts the state of an object by writing the public and private fields, name of the class, and the assembly containing the class into a stream of bytes. To make your objects serializable, you need to mark the class with the Serializable attribute.
    > >
    > > For more details.. See this...
    > >
    > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/objserializ.asp
    > >
    > > http://www.15seconds.com/issue/020903.htm
    > >
    > >
    > > --
    > > Thanks & Regards,
    > > John Paul. A
    > > MCP
    > >
    > >
    > > "Sangeetha Nagaraj" wrote:
    > >
    > > > I am developing a project for a courier service. My Manager suggested to use serialization.
    > > > I dont know anything about serialization in VB.NET. Can anyone give me some details about Serialization and how to use it practically...
    > > > --
    > > > Rgds,
    > > > Sang
     
    John Paul. A, Jul 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    2,293
    deadsea
    Jan 2, 2005
  2. Replies:
    0
    Views:
    675
  3. Replies:
    3
    Views:
    1,070
  4. Dimitri Ognibene
    Replies:
    4
    Views:
    813
    Dimitri Ognibene
    Sep 2, 2006
  5. Ramunas Urbonas
    Replies:
    1
    Views:
    422
    Dino Chiesa [Microsoft]
    Jul 27, 2004
Loading...

Share This Page