C # Summary of exceptions

Source: Internet
Author: User

C # Exception class 1. Exception of the base class
C # exceptions II. Common exceptions
1. SystemException class: this class is the base class of all other exception classes in the System namespace. (Recommended: exceptions caused by running in public languages are usually used)
2. ApplicationException class: This class indicates the exceptions caused by non-fatal errors of the application. (recommended: this class is usually used for exceptions caused by the application itself)
C # exception class 3. Parameter-related exceptions
This type of exception class is derived from SystemException, which is used to process parameters passed to method members. An exception occurs.
1. ArgumentException class: this class is used to handle invalid parameter exceptions. In addition to the inherited attribute names, this class also provides the string type attribute ParamName to indicate the parameter name that causes the exception.
2. FormatException class: this class is used to handle parameter format errors.
C # exception class 4. exceptions related to member access
1. MemberAccessException class: this class is used to handle exceptions caused by failed members of the lifecycle class. The possible cause of the failure is that you do not have sufficient access permissions, or the Members to be accessed do not exist at all (calls between classes are often used)
2. Direct derived class of the MemberAccessException class:
I. FileAccessException class: this class is used to handle exceptions caused by access field member failure.
Ii. MethodAccessException class: this class is used to handle exceptions caused by access method member failure.
Iii. MissingMemberException class: this class is used to handle exceptions thrown when a Member does not exist.
C # exception Category 5. array-related exceptions
The following three classes all inherit from the SystemException class
1. IndexOutOfException class: this class is used to handle exceptions caused by the subscript exceeding the array length.
2. ArrayTypeMismatchException class: this class is used to handle exceptions caused by elements that store incorrect data types in the array.
3. RankException class: this class is used to handle exceptions caused by dimension errors.
C # exception class 6. IO-related exceptions
1. IOException class: this class is used to handle exceptions caused by file input and output operations.
2. Five direct Derived classes of the IOException class:
I. direnotnotfoundexception class: this class is used to handle exceptions caused by the failure to find the specified directory.
Ii. FileNotFoundException class: this class is used to handle exceptions caused by files not found.
Iii. EndOfStreamException class: this class is used to process exceptions that have reached the end of the stream and continue reading data.
Iv. FileLoadException class: this class is used to handle exceptions caused by file loading failure.
V. PathTooLongException class: this class is used to handle exceptions caused by too long file names.
C # exceptions 7. Arithmetic exceptions
1. ArithmeticException class: this class is used to handle arithmetic-related exceptions.
2. derived class of the ArithmeticException class:
I. DivideByZeroException class: indicates the exception caused by trying to divide the integer by zero in decimal operation.
Ii. NotFiniteNumberException: indicates the exception caused by infinite or non-negative floating point operations.

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.