public static ObjectCopy GetObjectCopy(Type sourceType, Type targetType) { Dictionary<Type, ObjectCopy> casts = GetModuleCast(sourceType); ObjectCopy result; lock (casts) { if (!casts.TryGetValue(targetType, out result)) { result = new ObjectCopy(sourceType, targetType); casts.Add(targetType, result); } } return result; }
public static ObjectCopy GetObjectCopy(Type sourceType, Type targetType) { Dictionary <Type, ObjectCopy> casts = GetModuleCast(sourceType); ObjectCopy result; lock (casts) { if (!casts.TryGetValue(targetType, out result)) { result = new ObjectCopy(sourceType, targetType); casts.Add(targetType, result); } } return(result); }
public static void MemberCopyTo(this object source, object target) { ObjectCopy mc = ObjectCopy.GetObjectCopy(source.GetType(), target.GetType()); mc.Copy(source, target); }