C# Deserialization - c# - c# tutorial - c# net

What is C# De-Serialization ?

  • In C# programming, deserialization is the reverse process of serialization.
  • It means you can read the object from byte stream.
  • Here, we are going to use BinaryFormatter.Deserialize(stream) method to deserialize the stream.
 c sharp deserialization

C# Deserialization Example:

  • Let's see the simple example of deserialization in C#.
using System;  
using System.IO;  
using System.Runtime.Serialization.Formatters.Binary;  
class Student  
    public int rollno;  
    public string name;  
    public Student(int rollno, string name)  
        this.rollno = rollno;  
        this.name = name;  
public class DeserializeExample  
    public static void Main(string[] args)  
        FileStream stream = new FileStream("e:\\sss.txt", FileMode.OpenOrCreate);  
        BinaryFormatter formatter=new BinaryFormatter();  
        Student s=(Student)formatter.Deserialize(stream);  
        Console.WriteLine("Rollno: " + s.rollno);  
        Console.WriteLine("Name: " + s.name);  
click below button to copy the code. By - c# tutorial - team

C# examples - Output :

Rollno: 101
Name: ramu
learn c# tutorials - serialization deserialization language - c#

learn c# tutorial -csharp features - serialization deserialization language - c# Example

Related Searches to C# Deserialization

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.