Whilst the standard practice is to inherit from ICloneable (described here, so I wont regurgitate), here's a nice Deep Clone Object copier I found on codeproject a while ago and incorporated it in our stuff.
As mentioned above, it does require your objects to be Serializable
/// <summary>
/// Reference Article http://www.codeproject.com/KB/tips/SerializedObjectCloner.aspx
///
/// Provides a method for performing a deep copy of an object.
/// Binary Serialization is used to perform the copy.
/// </summary>
public static class ObjectCopier
{
/// <summary>
/// Perform a deep Copy of the object.
/// </summary>
/// <typeparam name="T">The type of object being copied.</typeparam>
/// <param name="source">The object instance to copy.</param>
/// <returns>The copied object.</returns>
public static T Clone<T>(T source)
{
if (!typeof(T).IsSerializable)
{
throw new ArgumentException("The type must be serializable.", "source");
}
// Don't serialize a null object, simply return the default for that object
if (Object.ReferenceEquals(source, null))
{
return default(T);
}
IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();
using (stream)
{
formatter.Serialize(stream, source);
stream.Seek(0, SeekOrigin.Begin);
return (T)formatter.Deserialize(stream);
}
}
}
The idea behind it is that it serializes your object the deserializes it into a fresh object. The benefit is that you don't have to concern yourself about cloning everything when an object gets too complex.
EDIT
And with the use of extension methods (also from the originally referenced source):
In case you prefer to use the new Extension methods of C# 3.0, change the method to have the following signature:
public static T Clone<T>(this T source)
{
...
}
Now the method call simply becomes objectBeingCloned.Clone();.