VS Exception handling
The try may produce an exception to the code, when a row produces an exception, the line below the code does not execute, go to the catch to start the catch (System. Exception e) e.message e.finally can be executed without this paragraph having an exception. such as turning off data connections.
- Can be handled according to the type of exception, such as 0 divided by a number, array out of bounds.
From top to bottom, find the kind that the current exception belongs to, Try{}catch (system.0 divided by the exception class name E) {}catch (System. Array out of bounds e) {}catch (System.Exception e) {}
If there is no corresponding type, the exception is transferred to the calling statement, no exception is handled, to the CLR, the CLR throws a unhandled exception in addition to the class library, or the exception that needs to be handled together, the exception is generally handled by the code snippet that may produce the exception. Nested try, which can be passed to an external call and passed to the calling statement
- You can throw an exception yourself, for
Exception myexception = new Exception ("message"); throw myexception;
- Customizable exceptions, inherited from System.application.exception
Class MyException (String Message): system.application.exception
{ }
- vs Set breakpoints When debugging, you can also view variables and objects.
Ablabla can look at the current line and the previous row used Lblabla can see in the life cycle of Watch can be seen in the life cycle, manual selection of concern, because in the life cycle of the possible many.
C#-vs Exception Handling