Useful Extension Method for ICloneable
- by DesigningCode
In the past, I’ve had to put a type specific clone in each cloneable class, but with extension methods you can write a generic T specific clone class Program
{
static void Main(string[] args)
{
var b = new Blah() {X = 1, Y = 2};
var bb = b.Clone();
Console.WriteLine(string.Format("{0} {1}",…