■
Note
As a rule, all custom exception classes should be defined as public types (recall, the default access
modifier of a non-nested type is internal). The reason is that exceptions are often passed outside of assembly
boundaries, and should therefore be accessible to the calling code base.
Create a new Console Application project named CustomException, and copy the previous Car
and Radio definitions into your new project using the Project ➤ Add Existing Item menu option (be
sure to change the namespace that defines the Car and Radio types from SimpleException to
CustomException). Next, add the following class definition:
Do'stlaringiz bilan baham: |