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);
            }
        }

 

相关文章:

  • 2021-09-09
  • 2022-12-23
  • 2021-08-22
  • 2022-03-07
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2022-01-18
猜你喜欢
  • 2022-03-10
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
相关资源
相似解决方案