I am returning a custom class from a WCF operation. The binding used is netTcp. This custom class contains several data members. One of them is a dataset. The dataset can be
You can just use the following:
using(var memory = new MemoryStream()) { using(var gzip = new GZipStream(memory, CompressionMode.Compress, true)) { var formatter = new BinaryFormatter(); formatter.Serialize(gzip, ds); } return memory.ToArray(); }