an easy way to clone a object is to serialize it to a stream and then deserialize it. From our BaseModel:
Code:
private object cloneBySerialization()
{
Object result;
MemoryStream buffer = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(buffer, this);
buffer.Position = 0;
result = formatter.Deserialize(buffer);
return result;
}
You just have to ensure that your objects are seializable. In most cases using the [Serializable] attribute on class level will fit.
Regards
Klaus