I have been creating object for a project and there are some instances that I have to create a deep copy for this objects I have come up with the use of a built in function
The solution using serialization, as suggested by sll, is by-far the simplest but doesn't work if the type you are trying to clone is not serializable.
The code from Felix K. is a good alternative but I found a few issues with it. Here is a revised version that fixes some of the problems I found. I also removed some of the functionality I didn't need (eg. constructor parameters).
///
/// A DeepClone method for types that are not serializable.
///
public static T DeepCloneWithoutSerialization(this T original)
{
return original.deepClone(new Dictionary