Exercise - Methods
- In ShowProduct:
- Mark the all the if statements inside the OnSavingRow.
- Using the control. extract them to a new method, name it InputValidation.
- Save changes to Git.
- Build and test.
- Change the last if statement:
- Extract the check for the Relation Row Found to a new method, name it ValidateCategoryID.
- Notice the bool returning value.
- Notice the use of return in the method.
- Save changes to Git.
- Build and test.
- Add region around the two new methods name it expressions
- Notice:
- You can collapse the region and expend it back.
- You can hover with the mouse over the collapse region to look at the code.
- Change the ValidateCategoryID() method to a one line method
- Save changes to Git.
- Build and test
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com