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

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -