- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Serialization and Deserialization in C#
Serialization converts objects into a byte stream and brings it to a form that it can be written on stream. This is done to save it to memory, file or database.
Serialization can be performed as −
All the members, even members that are read-only, are serialized
It serializes the public fields and properties of an object into XML stream conforming to a specific XML Schema definition language document.
Let us see an example. Firstly set the stream −
FileStream fstream = new FileStream("d:\
ew.txt", FileMode.OpenOrCreate); BinaryFormatter formatter=new BinaryFormatter();
Now create an object of the class and call the constructor which has three parameters −
Employee emp = new Employee(030, "Tom", “Operations”);
Deserialization is the reverse of serialization and with it, you can read the object from byte stream.
- What is Binary Serialization and Deserialization in C# and how to achieve Binary Serialization in C#?
- What is the difference between Serialization and Deserialization in Java?
- C# object serialization
- What is Deserialization in Java?
- What is serialization in C#.NET?
- Difference between Serialization and Externalization in Java
- Difference between readObject and readResolve method in serialization
- Python object serialization
- PHP Object Serialization
- What is Serialization in Java?
- Object Graph in Java Serialization
- Object Serialization with inheritance in Java
- Python object serialization (Pickle)
- Object Serialization with Inheritance in Java Programming
- Internal Python object serialization (marshal)