コード例 #1
0
        static DroidCollection droidCollection = new DroidCollection(); // >Holds the droids.

        static void Main(string[] args)
        {
            // >If a topMenu returns -1 the propram will end.
            while (exitApp == false)
            {
                switch (topMenuChoice)
                {
                case 1:
                    // >Display the menu and get the selected option.
                    UserInterface.Menu1(ref topMenuChoice, ref menuSelection);
                    switch (menuSelection)
                    {
                    case 1:
                        // >Add a droid.
                        droidCollection.AddADroid();
                        break;

                    case 2:
                        // >Print the droid list.
                        droidCollection.PrintDroidList();
                        break;

                    case 3:
                        // >Exit the program.
                        exitApp = true;
                        break;
                    }
                    break;

                case 2:
                    // >Can be used for another menu.
                    break;
                }
            }
        }