Example #1
0
        static void StrategyPattern()
        {
            Console.WriteLine("\n\nStrategy Pattern");
            var context = new StrategyPattern.Context(new Type1StrategyA(), new Type1StrategyB());

            context.Apply();
            context.SetStrategyA(new Type2StrategyA());
            context.Apply();

            context.Execute();
            context.SetStrategyB(new Type2StrategyB());
            context.Execute();
        }