zoukankan      html  css  js  c++  java
  • code

    public T Clone<T>(T RealObject)
    {
        using (System.IO.Stream objectStream = new System.IO.MemoryStream())
        {
            System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            formatter.Serialize(objectStream, RealObject);
            objectStream.Seek(0, System.IO.SeekOrigin.Begin);
            return (T)formatter.Deserialize(objectStream);
        }
    }  

  • 相关阅读:
    如何为创建大量实例节省内存?
    4-5
    4-6
    4-4
    4-3
    4-2
    3-11
    4-1
    3-10
    3-8
  • 原文地址:https://www.cnblogs.com/shijun/p/3807822.html
Copyright © 2011-2022 走看看