L. P. with Microsoft C# - Level 4-Quiz-1
- You should use Exceptions to handle any error or logical violation.
- To throw an exception means Raise an exception.
- All exceptions derive from class System.Exception.
- The ToString method Creates a string from the exception name.
- Try and Catch type of code you use when a section of code may throw an exception.
- You have a Try and Catch block, but you want some code to be run whether an exception is raised or not. You should Place it in a Finally block with this code.
- You Use a Catch block to avoid displaying an entire exception in the user's console.
- You want the Catch block of your code to respond to specific exceptions. You Write a catch block for each exception to do this.
- a catch block for System.Exception should be placed At the last catch block.
- The most specific catch first is the general rule for the ordering of catch blocks.
- Anytime the application does not throw them the way you want you should think about throwing a standard exception.
- An exception will not be thrown automatically every time there is an error or logic problem.
- the Constructor for an exception should be made By context.
- You can Create a custom exception if there is no exception that covers a problem that exists only for the purposes of the application, such as a business rule.
- How do you create a custom exception?
Create an exception class.
- How do you throw a custom exception?
The same as other exceptions.
Permalink |
Comments (0) | Hits: 1143 | Time: 21:56:48