Example #1
0
 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;
 }
Example #2
0
        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);
        }
Example #3
0
        public static void MemberCopyTo(this object source, object target)
        {
            ObjectCopy mc = ObjectCopy.GetObjectCopy(source.GetType(), target.GetType());

            mc.Copy(source, target);
        }