Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 // 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)));
 }