示例#1
0
        static void Main(string[] args)
        {
            Creator creator = new ConcreteCreator();
            Product product = creator.FactoryMethod();

            Console.WriteLine(product.Get_Type());
        }
示例#2
0
        static void Main(string[] args)
        {
            ConcreteCreator creator = new ConcreteCreator();

            creator.FactoryMethod(Type.A).DoSomething();
            creator.FactoryMethod(Type.B).DoSomething();
        }
示例#3
0
        static void Main(string[] args)
        {
            var messanger1 = new Messanger1("login", "password");
            var photo      = messanger1.CreateMessage("win.jpg", "user1", "user2");

            photo.Send();

            var messanger2 = new Messanger2("login", "password");
            var text       = messanger2.CreateMessage("some text", "user1", "user2");

            text.Send();

            var messanger3 = new Messanger3("login", "password");
            var text       = messanger3.CreateMessage("some text", "user1", "user2");

            text.Send();

            Console.ReadLine();

            // Создаем конкретного создателя и помещаем его в обобщенного создателя.

            Creator creator = new ConcreteCreator();

            // Создаем конкретный продукт и помещаем его в обобщенный продукт.

            IProduct product = creator.FactoryMethod();

            // Вызываем какое-либо действие обобщенного продукта,

            product.DoWork();
        }
示例#4
0
        static void Main(string[] args)
        {
            Creator  factory = new ConcreteCreator();
            IProduct product = factory.FactoryMethod("B");

            product.Print();
            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            Creator creator = new ConcreteCreator();
            Product product = creator.FactoryMethod();

            creator.AnOperation();

            Console.ReadLine();
        }
示例#6
0
        static void Main(string[] args)
        {
            // Назначение - быть основой всех порождающих паттернов

            var creator = new ConcreteCreator();
            var product = creator.FactoryMethod();

            Console.ReadKey();
        }
示例#7
0
        static void Main(string[] args)
        {
            Creator creator = null;
            Product product = null;

            creator = new ConcreteCreator();
            product = creator.FactoryMethod();

            creator.AnOperation();
        }
示例#8
0
        static void Main(string[] args)
        {
            Creator creator = null;
            Product product = null;

            creator = new ConcreteCreator();
            product = creator.FactoryMethod();

            Console.ReadKey();
        }
示例#9
0
        static void Main()
        {
            Creator creator = null;
            Product product = null;

            creator = new ConcreteCreator();
            product = creator.FactoryMethod();

            creator.AnOperation();
        }
示例#10
0
        static void Main(string[] args)
        {
            Creator creator = new ConcreteCreator();

            for (int i = 1; i <= 2; i++)
            {
                //створюємо спочатку продукт з типом 1, потім з типом 2
                var product = creator.FactoryMethod(i);
                product.Info();
            }
            Console.ReadKey();
        }
示例#11
0
        static void Main(string[] args)
        {
            //다른 종류의 객체를 생성할 수 있습니다.
            var creator  = new ConcreteCreator();
            var product0 = creator.Create(ProductID.Product);
            var product1 = creator.Create(ProductID.Product1);
            var product2 = creator.Create(ProductID.Product2);
            var product3 = creator.Create(ProductID.Product3);

            product0.print();
            product1.print();
            product2.print();
            product3.print();
        }
示例#12
0
        static void Main(string[] args)
        {
            var     creator = new ConcreteCreator();
            Product p;

            p = creator.FactoryMethod(-1);
            p.Show();
            p = creator.FactoryMethod(1);
            p.Show();
            p = creator.FactoryMethod(0);
            p.Show();

            Console.ReadKey();
        }
示例#13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var factory = new ConcreteCreator();

            var fcn1 = factory.Create(FitFunctionType.Polynomial);

            Console.WriteLine($"fcn1 type of fit is: {fcn1.GetTypeOfFit()}");

            var fcn2 = factory.Create(FitFunctionType.Table);

            Console.WriteLine($"fcn2 type of fit is: {fcn2.GetTypeOfFit()}");

            var fcn3 = factory.Create(FitFunctionType.Table);

            Console.WriteLine($"fcn3 type of fit is: {fcn3.GetTypeOfFit()}");
        }
示例#14
0
        static void Main(string[] args)
        {
            Creator creator = new ConcreteCreator();

            Product product = creator.FactoryMethod();
        }