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