예제 #1
0
 static void Main()
 {
     var client = new Client {Strategy = new ConcreteStrategyA()};
     client.CallAlgorithm();
     client.Strategy = new ConcreteStrategyB();
     client.CallAlgorithm();
 }
예제 #2
0
        private static void Main(string[] args)
        {
            Client client = new Client { Logger = new ConsoleLogger()};
            client.DoSomeStuff("need more work!");
            client.Logger = new DbLogger();
            client.DoSomeStuff("work hard");

            Console.ReadLine();
        }
예제 #3
0
        public static void Main(string[] args)
        {
            // create some names, as if by input or from some database:
            var names = new List<string> { "David", "Leonard", "Laura", "Linda", "Stephen", "Jean" };

            // TODO: refactor the client and algorithms so that uncommenting the folling line works:
            var someClient = new Client(new Algorithms.Cool());

            var results = someClient.ProcessNames(names);
            foreach(var result in results) {
                Console.WriteLine (result);
            };
        }