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/de...bjserializ.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