Ejemplo n.º 1
0
        public TObject CopyObject <TObject>(TObject originalObject)
        {
            PrintDeepCloningStrategy();
            WriteLine("Please enter the deep cloning strategy");

            string input = ReadLine();

            int inputInt = ValidateAndConvertInput(input, SystemConstants.MaxCloningStrategies, SystemConstants.InvalidStrategyError);

            ICloningStrategy strategy        = GetStrategy((CloningStrategyEnum)inputInt);
            CloningStrategy  cloningStrategy = new CloningStrategy(strategy);

            TObject copyObject = cloningStrategy.Clone <TObject>(originalObject);

            return(copyObject);
        }
Ejemplo n.º 2
0
 public void SetStrategy(ICloningStrategy strategy)
 {
     _strategy = strategy;
 }
Ejemplo n.º 3
0
 public CloningStrategy(ICloningStrategy strategy)
 {
     _strategy = strategy;
 }