static BDeepCopyFactory() { FactoryTypes = new HashSet <Type>(); // create list CopyFactories = new List <IBCopyFactory>() { // pure value types new PureValueTypeCopierFactory(), // array new ArrayCopierFactory(), // dictionary new DictionaryCopierFactory(), // list new ListWithSealedElementTypeCopierFactory(), new ListCopierFactory(), // interface new InterfaceCopierFactory() }; // save types foreach (IBCopyFactory f in CopyFactories) { FactoryTypes.Add(f.GetType()); } DefaultCopierFactory = new DefaultCopierFactory(); CheckFactories(); }
internal static IBCopierInternal Create(Type t) { CheckFactories(); for (int i = 0; i < CopyFactories.Count; i++) { IBCopyFactory curr = CopyFactories[i]; if (curr.CanCopy(t)) { return(curr.GetCopier(t)); } } return(DefaultCopierFactory.GetCopier(t)); }