コード例 #1
0
ファイル: Program.cs プロジェクト: linuxchata/patterns
        public static void Main(string[] args)
        {
            var context = new Context();

            var ingredients = new List <IExpression> {
                new Avocado(), new Tomato(), new Avocado()
            };
            var topBread    = new WheatBread();
            var bottomBread = new WhiteBread();
            var sandwich    = new Sandwich(topBread, new Ingredients(ingredients), bottomBread);

            sandwich.Interpret(context);

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jplopes/Patterns
        public static void Main(string[] args)
        {
            Sandwich sandhich = new Sandwich(
                new WheatBread(),
                new CondimentList(
                    new List <ICondiment> {
                new MayoCondiment(), new MustardCondiment()
            }),
                new IngredientList(
                    new List <IIngredient> {
                new LettuceIngredient(), new ChickenIngredient()
            }),
                new CondimentList(new List <ICondiment> {
                new KetchupCondiment()
            }),
                new WheatBread());

            sandhich.Interpret(new Context());

            Console.ReadKey();
        }