Namespace test {using system. diagnostics; using system. web; using system. web. services; using system. data; using system; using microshaoft; [WebService (namespace = "http://www.microshaoft.com/")] public class service1class: WebService {[webmethod] Public String helloworld () {return "Hello World";} [webmethod] public byte [] getdata () {dataset DS = new dataset (); // populate dataset to do return datasetserializer. datasettogzipbytes (DS);} static void main () {// todo: add Code To start the application Program // Byte [] DATA = datasetserializer. datasettogzipbytes (new dataset (); console. writeline (data. length); dataset DS = datasetserializer. gzipbytestodataset (data); console. writeline ("Hello World"); console. writeline (environment. version. tostring () ;}} namespace microshaoft {using system; using system. io; using system. data; using system. runtime. serialization; using system. runtime. serialization. formatter S. binary; public class datasetserializer {// server static public byte [] datasettogzipbytes (Dataset dataset) {memorystream MS = new memorystream (); iformatter F = new binaryformatter (); dataset. remotingformat = serializationformat. binary; F. serialize (MS, dataset); byte [] DATA = Ms. toarray (); Ms. close (); Ms. dispose (); MS = NULL; return compresshelper. gzipcompress (data);} // client static public dat Aset gzipbytestodataset (byte [] data) {DATA = compresshelper. gzipdecompress (data); memorystream MS = new memorystream (data); iformatter F = new binaryformatter (); dataset = f. deserialize (MS) as dataset; Ms. close (); Ms. dispose (); MS = NULL; return dataset ;}} namespace microshaoft {using system; using system. text; using system. io; using system. io. compression; // <summary> // Summary of crypto. /// </Summary> public class compresshelper {Private Static byte [] readstreamtobytes (Stream stream) {byte [] buffer = new byte [64*1024]; memorystream MS = new memorystream (); int r = 0; int L = 0; long position =-1; if (stream. canseek) {position = stream. position; stream. position = 0;} while (true) {r = stream. read (buffer, 0, buffer. length); If (r> 0) {L + = r; Ms. write (buffer, 0, R) ;}else {break ;}} byte [] bytes = new byte [l]; Ms. position = 0; Ms. read (bytes, 0, (INT) L); Ms. close (); MS = NULL; If (position> = 0) {stream. position = position;} return bytes;} public static byte [] gzipcompress (byte [] data) {memorystream MS = new memorystream (); gzipstream stream = new gzipstream (MS, compressionmode. compress, true); stream. write (data, 0, Data. length); stream. close (); stream. dispose (); stream = NULL; byte [] buffer = readstreamtobytes (MS); Ms. close (); Ms. dispose (); MS = NULL; return buffer;} public static byte [] gzipdecompress (byte [] data) {memorystream MS = new memorystream (data ); gzipstream stream = new gzipstream (MS, compressionmode. decompress); byte [] buffer = readstreamtobytes (Stream); Ms. close (); Ms. dispose (); MS = NULL; stream. close (); stream. dispose (); stream = NULL; return buffer;} public static byte [] deflatecompress (byte [] data) {memorystream MS = new memorystream (); deflatestream stream = new deflatestream (MS, compressionmode. compress, true); stream. write (data, 0, Data. length); stream. close (); stream. dispose (); stream = NULL; byte [] buffer = readstreamtobytes (MS); Ms. close (); Ms. dispose (); MS = NULL; return buffer;} public static byte [] deflatedecompress (byte [] data) {memorystream MS = new memorystream (data ); deflatestream stream = new deflatestream (MS, compressionmode. decompress); byte [] buffer = readstreamtobytes (Stream); Ms. close (); Ms. dispose (); MS = NULL; stream. close (); stream. dispose (); stream = NULL; return buffer ;}}}