C# Object Clone Wars

24 Comments »

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.

Read the rest of this entry »

Construct C# Objects at Runtime

No Comments »

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() );

Read the rest of this entry »