c# - How to serialize object to xml and compress in memory -


In my application, I should serial a large object for XML string. But then serialized throwing system. How can I sort out the object with exception and compression without otheoff memory exception?

  Public Static String GenerateXMLData & lt; T & gt; (T data) {byte [] bytes; (Var using memoryStream = new MemoryStream ()) (var gZipStream = new GZipStream (memoryStream, CompressionMode.Compress)) {BinaryFormatter binaryFormatter = New BinaryFormatter (); Binary formatting Serialize (GJprstream, data); } Bytes = MemoryStream. ToArray (); } Return encoding. UTF8.GetString (bytes); }    

There are very good answeers on the stackoverflow which one has accesed through

P>

:)

Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

c++ - Redefined variable in the other module -

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -