C# 深拷贝

来源:互联网 发布:时时彩开奖软件 编辑:程序博客网 时间:2024/06/10 03:19
        public static T DeepClone<T>(this T st)        {            BinaryFormatter bf = new BinaryFormatter();            MemoryStream ms = new MemoryStream();            bf.Serialize(ms, st);            ms.Position = 0;            return (T)bf.Deserialize(ms);        }