C # managing Exceptions and Errors
1,try/catch to catch the exception of the statement block, where try{} is written may be error program code,catch{} Is the code that throws the exception , and there can be multiple catchafter a try .
2, the exception is organized by inheritance hierarchy, the exception belongs to a family named systemexception(System exception), and systemexception belongs to Exception(abnormal) family.
3. What happens if an exception matches the multiple catch handlers at the end of the try block ?
Note: After an exception occurs, the first matching exception handler that is discovered by the runtime is run and other handlers are ignored. Therefore, after a try block, the more specific catch handler should be placed before the regular catch handler.
4, If the current value is already the maximum value of int 2147483647 plus 1, what will be the result?
By default, you will get an incorrect answer that overflows to the maximum negative value of -2147483647. Because integer operations are a common operation, overflow checking of each integer expression can result in severe performance degradation and, of course, the ability to enable overflow checking on its own.
5 checked unchecked keyword, checked unchecked force not to check all integer operations in the statement block, never throw an exception.
6.to ensure that a statement always runs, put it in a finally block. the finally block is either advanced after the try block, or the last catch after the try Block After. The finally block will always run whenever the program enters a try block associated with a finally block .
C # managing exceptions and Errors