Пример #1
0
 public void Prototype2()
 {
     ConcretePrototype2 prototype = new ConcretePrototype2();
       ConcretePrototype2 clone = (ConcretePrototype2)prototype.Clone();
       int value = clone.Value2;
       Assert.Equal(value, prototype.Value2);
 }
Пример #2
0
        //Прототип - Prototype
        public Run Prototype()
        {
            Console.WriteLine("\nPrototype:");

            // Create two instances and clone each
            Patterns.Creational.Prototype.Prototype p1 = new ConcretePrototype1("I");
            Patterns.Creational.Prototype.Prototype c1 = p1.Clone();
            Console.WriteLine("Cloned: {0}", c1.Id);

            Patterns.Creational.Prototype.Prototype p2 = new ConcretePrototype2("II");
            Patterns.Creational.Prototype.Prototype c2 = p2.Clone();
            Console.WriteLine("Cloned: {0}", c2.Id);

            return this;
        }