Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IIsItFridayService svc = new IsItFridayService();

            svc = new CachingDecorator(svc, TimeSpan.FromMinutes(5));
            svc = new LoggingDecorator(svc);

            Console.WriteLine("Is it friday? {0}", svc.IsItFriday());
            Console.WriteLine("Is it friday? {0}", svc.IsItFriday());

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            var reverser           = new ReverseBehavior();
            var exceptionDecorator = new ExceptionDecorator(reverser);
            var loggingDecorator   = new LoggingDecorator(exceptionDecorator);
            var threadingDecorator = new ThreadingDecorator(loggingDecorator);
            var timerDecorator     = new TimerDecorator(threadingDecorator);
            //var nullDecorator = new NullDecorator(timerDecorator);

            var result = timerDecorator.Apply("abc");

            Console.WriteLine(result);

            Console.ReadKey();
        }