Hi Friends,
I want to know more about Serialization and how it is Implemented in asp.net Web Applications.
please let me know how we can use it by Example.
Thanks,
Aamir
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MuthuMari MPosted Apr 23, 2012, 10:55 AM
Serialization is the process of converting an object into a stream of bytes.
The easiest way to make a class serializable is to mark it with the Serializable attribute as follows:
[Serializable] public class MyObject { public int n1 = 0; public int n2 = 0; public String str = null; }refer this url for more info:
http://msdn.microsoft.com/en-us/library/ms973893.aspx
thanks.
If this post is useful then mark it as "Accepted Answer"
Satyapriya NayakPosted Apr 23, 2012, 9:54 AM
Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.
Binary serialization preserves type fidelity, which is useful for preserving the state of an object between different invocations of an application. For example, you can share an object between different applications by serializing it to the clipboard. You can serialize an object to a stream, disk, memory, over the network, and so forth. Remoting uses serialization to pass objects "by value" from one computer or application domain to another.
XML serialization serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard, it is an attractive choice for sharing data across the Web. SOAP is an open standard, which makes it an attractive choice. There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.
Also Please refer Our recommended articles
http://www.c-sharpcorner.com/uploadfile/b19d5a/use-of-serialization-in-C-Sharp/default.aspx
http://www.c-sharpcorner.com/UploadFile/Nimusoft/Serialization106262007072102AM/Serialization1.aspx
http://www.c-sharpcorner.com/UploadFile/alex233/ClassSerialization12032005020137AM/ClassSerialization.aspx
http://www.c-sharpcorner.com/uploadfile/b81385/best-practices-in-net-xml-serialization-of-complex-classes/default.aspx
http://www.c-sharpcorner.com/UploadFile/sayginteh/SerializationSampleCode12032005062001AM/SerializationSampleCode.aspx
http://www.c-sharpcorner.com/UploadFile/jaishmathews/ApplySerializationinaRealLifeSituation03252006092701AM/ApplySerializationinaRealLifeSituation.aspx
Thanks
SenthilkumarPosted Apr 23, 2012, 8:26 AM
The serialization is process of convert an object type into stream of bytes.
There are several types
1) Binary serialization
2) SOAP serialization
3) XML serialization
4) Custom serialization
For more info:
http://aspalliance.com/983_Introducing_Serialization_in_NET.all
Kunal VaishyaPosted Apr 23, 2012, 8:05 AM
Object Serialization in the .NET Framework
http://msdn.microsoft.com/en-us/library/ms973893.aspx