#region Binary Serializers public static System.IO.MemoryStream SerializeBinary(object request) { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.MemoryStream memStream = new System.IO.MemoryStream(); serializer.Serialize(memStream, request); return memStream; }
public static object DeSerializeBinary(System.IO.MemoryStream memStream) { memStream.Position=0; System.Runtime.Serialization.Formatters.Binary.BinaryFormatter deserializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); object newobj = deserializer.Deserialize(memStream); memStream.Close(); return newobj; } #endregion
#region XML Serializers public static System.IO.MemoryStream SerializeSOAP(object request) { System.Runtime.Serialization.Formatters.Soap.SoapFormatter serializer = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter(); System.IO.MemoryStream memStream = new System.IO.MemoryStream(); serializer.Serialize(memStream, request); return memStream; }
public static object DeSerializeSOAP(System.IO.MemoryStream memStream) { object sr; System.Runtime.Serialization.Formatters.Soap.SoapFormatter deserializer = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter(); memStream.Position=0; sr = deserializer.Deserialize(memStream); memStream.Close(); return sr; } #endregion |