public static T Deserialize<T, S>(S stream) where S : Stream where T : class, new() { using (stream) { BinaryFormatter formatter = new BinaryFormatter(); return (T)formatter.Deserialize(stream); } } public static void Serialize<T, S>(T obj, S stream) where S : Stream where T : class, new() { using (stream) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, obj); } }
c# 二进制序列化
猜你喜欢
转载自www.cnblogs.com/yuanzijian-ruiec/p/9720890.html
今日推荐
周排行