How to access Serialised object of an application ?
-
Dear All, I am using the below code to serialise my class object. i want to access this serialised object into another application . Please let me know how to go about it. [Serializable] class Sample { public int i = 0; public int j = 0; public string str = ""; static void Main(string[] args) { Sample objSample = new Sample(); objSample.i = 1222; objSample.j = 5555; objSample.str = "This is serialised data"; IFormatter formatter = new BinaryFormatter(); Stream fs = new FileStream("MyFile.bin", FileMode.Create, FileAccess.ReadWrite, FileShare.None); formatter.Serialize(fs, objSample); fs.Close(); Console.WriteLine("Class serialised"); }
-
Dear All, I am using the below code to serialise my class object. i want to access this serialised object into another application . Please let me know how to go about it. [Serializable] class Sample { public int i = 0; public int j = 0; public string str = ""; static void Main(string[] args) { Sample objSample = new Sample(); objSample.i = 1222; objSample.j = 5555; objSample.str = "This is serialised data"; IFormatter formatter = new BinaryFormatter(); Stream fs = new FileStream("MyFile.bin", FileMode.Create, FileAccess.ReadWrite, FileShare.None); formatter.Serialize(fs, objSample); fs.Close(); Console.WriteLine("Class serialised"); }