public static DataSet arrByteToDataSet(byte[] zipBuffer) { if (zipBuffer == null || zipBuffer.Length < 1) { return(null); } byte[] buffer = UnZipClass.Decompress(zipBuffer); BinaryFormatter ser = new BinaryFormatter(); DataSetSurrogate dss = ser.Deserialize(new MemoryStream(buffer)) as DataSetSurrogate; DataSet dataSet = dss.ConvertToDataSet(); return(dataSet); }
private void button4_Click(object sender, EventArgs e) { WebServices.SOAPTEST.SOAPTEST ds = new WebServices.SOAPTEST.SOAPTEST(); DateTime dtBegin = DateTime.Now; byte[] zipBuffer = ds.GetDataSetSurrogateZipBytes(); byte[] buffer = UnZipClass.Decompress(zipBuffer); BinaryFormatter ser = new BinaryFormatter(); DataSetSurrogate dss = ser.Deserialize(new MemoryStream(buffer)) as DataSetSurrogate; DataSet dataSet = dss.ConvertToDataSet(); this.label4.Text = string.Format("耗时:{0}", DateTime.Now - dtBegin) + " " + zipBuffer.Length; binddata(dataSet); }