Exercise - Methods

  1. In ShowProduct:
  2. Mark the all the if statements inside the OnSavingRow.
  3. Using the control. extract them to a new method, name it InputValidation.
  4. Save changes to Git.
  5. Build and test.
  6. Change the last if statement:
    1. Extract the check for the Relation Row Found to a new method, name it ValidateCategoryID.
    2. Notice the bool returning value.
    3. Notice the use of return in the method.
  7. Save changes to Git.
  8. Build and test.
  9. Add region around the two new methods name it expressions
  10. Notice:
    1. You can collapse the region and expend it back.
    2. You can hover with the mouse over the collapse region to look at the code.
  11. Change the ValidateCategoryID() method to a one line method
  12. Save changes to Git.
  13. Build and test

Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com