One of best practices is to implement ICloneable on our objects. However most os times it is not used or because it comes from db or they are created as news.. It depends on many variables.
What happens is that most of time it is not implemented (since I left Uminhos university I don’ t really remember how many times I have done it…. but there was a little few).
So I pretend on doing it! Because of that I googled a little and I found a nice class to extend objects so they are cloneable:
public static class ExtensionMethods
public static T DeepCopy(this T oSource)
DataContractSerializer dcs = new DataContractSerializer(typeof(T));
using (MemoryStream ms = new MemoryStream())
ms.Position = 0;
oClone = (T)dcs.ReadObject(ms);
my source was Jason Barkes on his blog.