Esempio n. 1
0
        static void Main(string[] args)
        {
            SandwichMenu menu = new SandwichMenu();

            menu["BLT"]    = new Sandwich("Wheat", "Bacon", "Lettuce", "Tomato");
            menu["PB&J"]   = new Sandwich("White", "", "", "Peanut Butter, Jelly");
            menu["Turkey"] = new Sandwich("Rye", "Turkey", "Swiss", "Lettuce, Onion, Tomato");

            Sandwich bltSandwich1    = menu["BLT"].Clone() as Sandwich;
            Sandwich pbjSandwich1    = menu["PB&J"].Clone() as Sandwich;
            Sandwich turkeySandwich1 = menu["Turkey"].Clone() as Sandwich;
        }
        static void Main(string[] args)
        {
            SandwichMenu sandwichMenu = new SandwichMenu();

            //Initialize with default sandwiches
            sandwichMenu["BLT"]    = new Sandwich("Wheat", "Becon", "", "Lettuce, Tomato");
            sandwichMenu["PB&J"]   = new Sandwich("White", "", "", "Peanut Butter, Jelly");
            sandwichMenu["Turkey"] = new Sandwich("Rye", "Turkey", "Swiss", "Lettuce, Onion, Tomato");

            //Add custom sandwiches
            sandwichMenu["LoadedBLT"]      = new Sandwich("Wheat", "Turkey, Becon", "American", "Lettuce, Tomato, Onion, Olives");
            sandwichMenu["ThreeMeatCombo"] = new Sandwich("Rye", "Turkey, Ham, Salami", "Provolone", "Lettuce, Onion");
            sandwichMenu["Vegetarian"]     = new Sandwich("Wheat", "", "", "Lettuce, Onion, Tomato, Olives, Spinach");

            //Clone this sandwiches
            Sandwich sandwichOne   = sandwichMenu["BLT"].Clone() as Sandwich;
            Sandwich sandwichTwo   = sandwichMenu["ThreeMeatCombo"].Clone() as Sandwich;
            Sandwich sandwichThree = sandwichMenu["Vegetarian"].Clone() as Sandwich;
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            SandwichMenu menu = new SandwichMenu();

            menu["BLT"]    = new Sandwich("Wheat", "Bacon", "", "lettcue, Tomato");
            menu["PB&J"]   = new Sandwich("White", "", "", "Peanut Butter, Jelly");
            menu["Turkey"] = new Sandwich("Rye", "Turkey", "", "lettcue, Onion, Tomato");

            menu["LoadedBLT"]      = new Sandwich("Wheat", "Turkey,Bacon", "American", "lettuce, Tomato,Onion,Olives");
            menu["ThreeMeatCombo"] = new Sandwich("Rye", "Turkey, Ham, Salami", "Provolone", "Lettuce, Onion");
            menu["Vegetarian"]     = new Sandwich("What", "", "", "Letuce, Onion, Tomato, Olives, Spinach");

            Sandwich sandwich1 = menu["BLT"].Clone() as Sandwich;
            Sandwich sandwich2 = menu["ThreeMeatCombo"].Clone() as Sandwich;
            Sandwich sandwich3 = menu["Vegetarian"].Clone() as Sandwich;

            Sandwich burger     = new Sandwich("Wheat", "Bacon", "Amrican", "Lettuce, Tomato");
            Sandwich burgerCopy = burger.Clone() as Sandwich;

            burger = new Sandwich("White", "Bacon", "American", "Lettuce");
            ;
        }