发送时
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, dt);
byte[] tableBT = ms.ToArray();
发送tableBT
接收后
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream(getByte);
DataTable dt = bf.Deserialize(ms) as DataTable;

本文介绍了一种使用BinaryFormatter序列化和反序列化DataTable的方法。发送方通过BinaryFormatter将DataTable对象转换为字节数组进行传输;接收方再利用BinaryFormatter将接收到的字节数组还原为原始的DataTable对象。

1472

被折叠的 条评论
为什么被折叠?



