I did some research last night and found that I can make my own clone functions where I'd copy entity members to a new instance and return the new one, but this is problematic when there isn't an empty ConvexHull constructor with empty members. Honestly, that doesn't really bother me because I'd rather have a memcpy-type solution.
I also tried Serializing/Deserializing my entity but visual studio informed me that some of the members could not be serialized.
...for the following code...An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: Type 'DiceRoller.Dice.DieBase' in Assembly 'DiceRoller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Code: Select all
public object Clone()
{
System.IO.MemoryStream m = new System.IO.MemoryStream();
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b =
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
b.Serialize(m, this);
m.Position = 0;
return b.Deserialize(m);
//return (object)MemberwiseClone();
}
--Alex