C #-VS Exception Handling,

Source: Internet
Author: User

C #-VS Exception Handling,
VS Exception Handling

  • General
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 ){}
  • Exception Transfer
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.