Skip to main content

Posts

Showing posts with the label SOAP

Data Serialization in .Net

Namespace: System.Runtime.Serialization Serialization is the process of converting object so that they can be transmitted over the network, or stored in file for later use, or passing them to a web service or any other application. .Net WebServices, Session Object, .Net Remoting and clipboard rely on Serialization. Binary Serialization: It’s efficient but not portable solution. String data = “Hello”; FileStream fs = new FileStream(“FileStream.Data”, FileMode.Create); BinaryFormatter bf = new BinarFormatter (); Bf.Serilize(fs, data); //Wrting Objects Bf.Serilize(fs,System.DateTime.Now); Fs.close(); Deserializing Objects FileStream fs = new FileStream(“FileStream.Data”, FileMode.Open); BinaryFormatter bf = new BinarFormatter (); String Data = (String)bf.Deserialize(fs); DateTime vTime = (DateTime) bf.Derialize(fs); To serialize a class one must the Serializeable attribute to that class. To omit some attribute from deseriali...