Exercise – Build sample data and menu selection loops

In this exercise, you review the code in the Starter project, perform some code clean-up tasks, and then start adding features to your application. The tasks that you complete during this exercise are:

  1. Code review: review the contents of the Program.cs file.
  2. Sample data: convert the if-elseif-else structure to switch-case structure that improves readability.
  3. Menu loop: enclose the main menu and menu item selection in a loop that iterates until the user enters “exit”.
  4. Menu selections: write the code for a switch-case structure that establishes separate code branches for each menu option.
  5. Code branches: write placeholder within the menu item branches that provides user feedback until app features are developed.
  6. Verification test: perform verification tests for the code that you develop in this exercise.

Review the contents of the Program.cs file

In this task, you complete a walkthrough of the Starter project code. The Program.cs file contains a preliminary version of the application that you update during this module. The existing code generates sample data for the application and displays a list of menu options. The menu options represent the main features of your application.

  1. Ensure that the GuidedProject folder is open in Visual Studio Code.The previous unit includes a Setup section that describes how to open the Starter project. If necessary, go back and follow the Setup instructions.
  2. In the EXPLORER view, expand the Starter folder, then select Program.cs.When you select the Program.cs file, the file contents open in the Visual Studio Code Editor.If the EXPLORER view isn’t open, select EXPLORER from the Visual Studio Code Activity Bar. The EXPLORER button is at the top of the Activity Bar.
  3. Take a few minutes to review the code in the Program.cs file.
  4. Notice that the top portion of your code begins with some variable declarations.

dynamics 365 sales training courses malaysia

Leave a Reply

Your email address will not be published. Required fields are marked *