public object Clone(ICloneContext context, object src) { var target = FormatterServices.GetUninitializedObject(_type); foreach (var cloneField in _cloneFields) { var value = cloneField.Get(src); if (cloneField.Deep) { value = context.Clone(value); } cloneField.Set(target, value); } return(target); }
// It's used by reflection from CloneObjectEx public static object Clone(ICloneContext context, object src) { return(Array.ConvertAll((T[])src, x => (T)context.Clone(x))); }