/// <summary>
/// 字节数组转对象
/// </summary>
/// <param name="buff"></param>
/// <returns></returns>
public static object Bytes2Object(byte[] buff)
{
object obj;
using (MemoryStream ms = new MemoryStream(buff))
{
IFormatter iFormatter = new BinaryFormatter();
obj = iFormatter.Deserialize(ms);
}
return obj;
}
来源:https://www.cnblogs.com/apimeng/p/12374058.html