Kiran's personal website
Blog    Forums   Sitemap   Social    Phone

Knowledge base home, and site home.
List of all Knowledge base categories.
An alphabetical list of technical terms.
Contact Me
Contact me for knowledge base questions
My Blog
My articles, white papers, ideas and thoughts.


Serializing and De-Serializing the Objects.

Date Added July 23, 2010 | Print | Bookmark

//Required the following using directives
//using System;
//using System.IO;
//using System.Runtime.Serialization.Formatters.Binary;

//Serializing and De-Serializing the Objects:

private void SerializeObject(Object object, string fileName){

 Stream binaryStream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite);
      BinaryFormatter binaryFormatter = new BinaryFormatter();
      binaryFormatter.Serialize(binaryStream, object);


private Object DeSerialiseObject(string fileName){

 BinaryFormatter binaryFormatter = new BinaryFormatter();
 Stream reader = File.Open(fileName, FileMode.Open, FileAccess.Read);
     Object object = binaryFormatter.Deserialize(reader);

 return object;

Was this article helpful?

Yes No

Category: C#.NET- I/O

Last updated on July 29, 2010 with 5429 views


Home | About Me | Products | Support | Contact | Knowledgebase | Forums | Blog | Site map | Site Search | Subscribe | Links | Social | News

Travel | Guest Book | All Pages | History | Site Calendar | Recipes | Ex-Rates | UK Stuff | Downloads | Telugu Stuff | Tell a Friend | Feedback

Bookmark and Share
Terms of Use
Site contents Copyright © 2008-2009 Kiran Reddy. All rights reserved.