コード例 #1
0
ファイル: Program.cs プロジェクト: masifjaved/DesignPatterns
        static void Main()
        {
            var component = new ConcreteComponent();
            var decorator = new ConcreteDecorator(component);

            decorator.Operation();
        }
コード例 #2
0
        static void Main()
        {
            ConcreteDecorator decorator = new ConcreteDecorator();

            Component component = new ConcreteComponentA();

            decorator.Component = component;
            decorator.Operation();

            Console.WriteLine(new string('-', 30));

            component           = new ConcreteComponentB();
            decorator.Component = component;
            decorator.Operation();

            // Delay.
            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Component obj = new ConcreteComponent();

            obj.Operation();
            Decorator objDecorator = new ConcreteDecorator();

            objDecorator.SetComponent(obj);
            objDecorator.Operation();
            Decorator objDecorator2 = new ConcreteDecorator2();

            objDecorator2.SetComponent(objDecorator);
            objDecorator2.Operation();
        }
コード例 #4
0
 static void Main()
 {
     var component = new ConcreteComponent();
     var decorator = new ConcreteDecorator(component);
     decorator.Operation();
 }