标签:des blog os io ar for 2014 log on
private T BytesToT<T>(byte[] bytes) { using (var ms = new MemoryStream()) { ms.Write(bytes, 0, bytes.Length); var bf = new BinaryFormatter(); ms.Position = 0; var x = bf.Deserialize(ms); return (T)x; } } private byte[] TToBytes<T>(T obj) { var bf = new BinaryFormatter(); using (var ms = new MemoryStream()) { bf.Serialize(ms, obj); return ms.ToArray(); } }
标签:des blog os io ar for 2014 log on
原文地址:http://blog.csdn.net/lan_liang/article/details/39031285