Thursday, April 12, 2007

Easiest way to Clone in C#

public object Clone()
{
MemoryStream stream = new MemoryStream();
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Serialize(stream, this);
stream.Position = 0;
return bformatter.Deserialize(stream);
}

No comments:

Post a Comment

Please, no abusive word, no spam.