コード例 #1
0
        static void Main(string[] args)
        {
            var sandwich  = new Sandwich("bread", "meat", "cheese", "veggies");
            var sandwich2 = sandwich.Clone() as Sandwich;

            Console.WriteLine(sandwich.Bread == sandwich2.Bread);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            SandwichMenu menu = new SandwichMenu();

            menu["BLT"]    = new Sandwich("Wheat", "Bacon", "", "Tomato");
            menu["Turkey"] = new Sandwich("Rye", "Turkey", "Swiss", "Lettuce, Onion");

            Sandwich sandwich1 = menu["BLT"].Clone() as Sandwich;
            Sandwich sandwich2 = menu["Turkey"].Clone() as Sandwich;
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            SandwichMenu sandwichMenu = new SandwichMenu();

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

            Sandwich sandwich1 = sandwichMenu["BLT"].Clone() as Sandwich;
            Sandwich sandwich2 = sandwichMenu["Turkey"].Clone() as Sandwich;
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var menu = new SandwichMenu();

            menu["BLT"]    = new Sandwich("Wheat", "Bacon", "Cheddar", "Lettuce, Tomato");
            menu["PB&J"]   = new Sandwich("White", "", "", "Peanut butter, Jelly");
            menu["Turkey"] = new Sandwich("Rye", "Turkey", "Emmentaller", "Lettuce, Onions, Tomato");

            var s1 = menu["BLT"].Clone() as Sandwich;
            var s2 = menu["PB&J"].Clone() as Sandwich;
            var s3 = menu["Turkey"].Clone() as Sandwich;
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            SandwichMenu menu = new SandwichMenu();

            menu["BLT"] = new Sandwich("Wheat", "Bacon", "Emental", "Lettuce, Tomatoes");

            menu["Vegetarian"] = new Sandwich("Wheat", "", "", "Cucumber");

            Sandwich firstSandwich = menu["BLT"].Clone() as Sandwich;

            Sandwich secondSandwich = menu["Vegetarian"].Clone() as Sandwich;
        }
コード例 #6
0
        public static void Main()
        {
            var sandiwchMenu = new SandwichMenu();

            sandiwchMenu["Italian"]  = new Sandwich("White", "Bacon", "", "cucumber");
            sandiwchMenu["American"] = new Sandwich("White", "RawShit", "FrenchCheese", "Tomato");
            sandiwchMenu["German"]   = new Sandwich("Rye", "Bacon", "", "cucumber");

            var s1 = sandiwchMenu["Italian"].Clone() as Sandwich;
            var s2 = sandiwchMenu["American"].Clone() as Sandwich;
            var s3 = sandiwchMenu["German"].Clone() as Sandwich;
        }
コード例 #7
0
        static void Main(string[] args)
        {
            SandwichMenu sandiwchMenu = new SandwichMenu();

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

            sandiwchMenu["Vegetarian"]     = new Sandwich("Wheat", "", "", "Lettuce, Onion, Tomato, Olive, Spinach");
            sandiwchMenu["ThreeMeatCombo"] = new Sandwich("Rye", "Turkey, Ham, Salami", "Provolone", "Lettuce, Onion");

            Sandwich firstSandwich   = sandiwchMenu["BLT"].Clone() as Sandwich;
            Sandwich secondSandwitch = sandiwchMenu["ThreeMeatCombo"].Clone() as Sandwich;
            Sandwich thirdSandwich   = sandiwchMenu["Turkey"].Clone() as Sandwich;
        }
コード例 #8
0
        public 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");

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

            Sandwich sandwich1 = menu["BLT"].Clone() as Sandwich;
            Sandwich sandwich2 = menu["ThreeMeatCombo"].Clone() as Sandwich;
        }
コード例 #9
0
        public static void Main()
        {
            SandwichMenu sandwichMenu = new SandwichMenu();

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

            sandwichMenu["LoadedBLT"]      = new Sandwich("Wheat", "Turkey, Bacon", "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");

            Sandwich firstCloneSandwich  = sandwichMenu["BLT"].Clone() as Sandwich;
            Sandwich secondCloneSandwich = sandwichMenu["ThreeMeatCombo"].Clone() as Sandwich;
            Sandwich thirdCloneSandwich  = sandwichMenu["PB&J"].Clone() as Sandwich;
        }
コード例 #10
0
        public static void Main()
        {
            SandwichMenu sandwichMenu = new SandwichMenu();

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

            //Deli manager adds custom sandwiches
            sandwichMenu["LoadedBLT"]      = new Sandwich("Wheat", "Turkey, Bacon", "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");

            //Now we clone these sandwiches
            Sandwich sandwich1 = sandwichMenu["BLT"].Clone() as Sandwich;
            Sandwich sandwich2 = sandwichMenu["ThreeMeatCombo"].Clone() as Sandwich;
            Sandwich sandwich3 = sandwichMenu["Vegetarian"].Clone() as Sandwich;
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: delbusque/SoftUni
        static void Main(string[] args)
        {
            Sandwich sandwich          = new Sandwich("grain", "rockfor", "chicken", "onion, spinach");
            Sandwich prototypeSandwich = (Sandwich)sandwich.Clone();

            Console.WriteLine(prototypeSandwich.GetIngredients());

            SandwichMenu sandwiches = new SandwichMenu();

            sandwiches["Chicken"] = new Sandwich("grain", "rockfor", "chicken", "onion");
            sandwiches["Beef"]    = new Sandwich("grain", "mature", "beef", "onion");
            sandwiches["Veggie"]  = new Sandwich("grain", "", "", "onion, spinach");

            sandwiches["LoadedChicken"] = new Sandwich("rye", "gauda, mature", "chicken", "onion");
            sandwiches["ThreeMeat"]     = new Sandwich("wheat", "swiss", "beef, bacon, ham", "tomato");

            Sandwich sandwich1 = sandwiches["Beef"].Clone() as Sandwich;
            Sandwich sandwich2 = sandwiches["Veggie"].Clone() as Sandwich;
            Sandwich sandwich3 = sandwiches["ThreeMeat"].Clone() as Sandwich;

            Console.WriteLine(sandwich3.GetIngredients());
        }
コード例 #12
0
        static void Main(string[] args)
        {
            Sandwich sandwich = new Sandwich("", "", "", "");

            Console.WriteLine(sandwich.Clone());
        }