Code Snippet
- // Usage
- CLASSNAME clonedInstance = DeepClone<CLASSNAME>(instance);
- // Deep clones an object
- // Your class (and all sub-classes) MUST be marked as [Serializable] in order for this to work.
- public static T DeepClone<T>(T obj)
- {
- {
- formatter.Serialize(ms, obj);
- ms.Position = 0;
- return (T)formatter.Deserialize(ms);
- }
- }
End of Code Snippet
1 comment:
Hello nice bblog
Post a Comment