示例#1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            //EN : Decide to one of the strategies / TR : Stratejilerden birisine karar verilir.
            //EN : You can use Factory method to select one of the strategies
            // TR : Stratejilerden birisini seçmek için, fabrika metodu kullanabilirsiniz.

            ICalculationStrategy strategy = new StrategyB(); // EN : We have decided With simple method / TR : Basit metod ile karar verdik.
            CompanyContext       context  = new CompanyContext(strategy);

            MessageBox.Show(" Result / Sonuç = " + context.Calculate().ToString());
        }
        static void Main(string[] args)
        {
            IStrategy strategy = new StrategyA();

            strategy.Execute();

            strategy = new StrategyB();
            strategy.Execute();

            strategy = new StrategyC();
            strategy.Execute();

            Console.ReadLine();
        }