C #-VS Exception Handling,
VS Exception Handling
Try may generate abnormal code. If one line produces an exception, the code below this line will not be executed, go to catch to start executing catch (system. exception e) e. message e. finally can be executed without any exception. For example, close the data connection.
- It can be handled by exception type separately. For example, if 0 is divided by a number, the array is out of bounds.
From top to bottom, find the type of the current exception. try {} catch (exception class name e divided by system.0) {} catch (system. array out-of-bounds e) {} catch (system. exception e ){}
If there are no corresponding types, the exception will be transferred to the call statement. If no exception is handled, the clr will throw an unhandled exception except for the class library or the case where exceptions need to be handled together, exceptions are generally handled by code segments that may generate exceptions. Nested try, which can be passed to external calls and can be passed to call statements
- You can throw an exception
Exception myException = new Exception ("message"); throw myException;
- Custom exceptions are inherited from system. application. exception.
Class myException (string Message): system. application. exception
{}
- VS allows you to view variables and objects during breakpoint debugging.
Ablabla can view the Lblabla used in the current row and the previous row. You can view the watch in the lifecycle. You can manually choose to pay attention to it because there may be many lifecycles.