public static T Clone<T>(this T source) where T : class
{
T nobj = (T)Activator.CreateInstance(typeof(T));
var props = typeof(T).GetProperties();
foreach (var p in props)
{
p.SetValue(nobj, p.GetValue(source));
}
return nobj;
}
Comments