May 22
Cloning C# objects is one of those things that appears easy but is actually quite complicated with many “gotchas.” This article describes the most common ways to clone a C# object.
Cloning C# objects is one of those things that appears easy but is actually quite complicated with many “gotchas.” This article describes the most common ways to clone a C# object.
Creating C# objects at run-time is easy. Just call the Activator.CreateInstance method.
For example, to create the same type of object as the current object using its default constructor:
Activator.CreateInstance( this.GetType() );