5
Reply

C# interview question :- What is Serialization in .NET ?

    This is a great question! Serialization in .NET is essentially the process of converting an object into a stream of bytes so it can be stored or transmitted, and then reconstructed later.
    Snow Rider 3D

    For the best and most reliable companionship, choose our VIP Escorts Agency. We pride ourselves on having the most beautiful and professional girls in Delhi. Our escorts are well-educated, stylish, and extremely fun to be with. They provide genuine company and ensure that every moment spent with them is filled with joy, laughter, and romance.

    Imagine if someone approached you with a small hourglass saying, “You have three minutes to kiss every inch of my arm.” With our Delhi escort service, exploration becomes a timed treasure hunt. That limitation pushes you to be creative, to concentrate, and to be all here.

    Hauz Khas Escorts
    Escorts in South Delhi
    Indirapuram Escorts Service
    Escorts Service Mayur Vihar
    Escorts Service in ITO

    Surrender every inhibition when you experience with our Okhla Escorts Service that delivers pure, primal passion from the first hello to the final satisfied sigh. She'll undress you with her eyes before her hands ever touch your skin, building anticipation that explodes into ecstasy.

    Answer:

    Serialization is a process by which we can save the state of the object by converting the object in to stream of bytes.These bytes can then be stored in database, files, memory etc.

    Below is a simple code of serializing the object.

    MyObject objObject = new MyObject();

    objObject.Value = 100;
    // Serialization using SoapFormatter

    SoapFormatter formatter = new SoapFormatter();

    Stream objFileStream = new FileStream("c:\\MyFile.xml", FileMode.Create,
    FileAccess.Write, FileShare.None);

    formatter.Serialize(objFileStream, objObject);

    objFileStream.Close();

    Below is simple code which shows how to deserialize an object.
     

    //De-Serialization

    Stream objNewFileStream = new FileStream("c:\\MyFile.xml", FileMode.Open,
    FileAccess.Read, FileShare.Read);

    MyObject objObject =(MyObject)formatter.Deserialize(objNewFileStream);

    objNewFileStream.Close();


    View my top 21 .NET Interview questions and answers