Catch common exception types in C #

Source: Internet
Author: User

Exception class

 

Description

 

Systemexception Basic exceptions that other users can handle
Argumentexception The method parameter is invalid.
Argumentnullexception An empty parameter is passed to the method. This method cannot accept this parameter.
Argumentoutofrangeexception Parameter value out of range
Arithmeticexception Arithmetic overflow or underflow
Arraytypemismatchexception Try to store error type objects in array
Badimageformatexception Incorrect image format
Dividebyzeroexception Zero division exception
Dllnotfoundexception The referenced DLL cannot be found.
Formatexception Parameter format Error
Indexoutofrangeexception Array Index out of range
Invalidcastexception Invalid class
Invalidoperationexception The call time of the method is incorrect.
Methodaccessexception Attempt to access friends or protected Methods
Missingmemberexception Access an invalid version of DLL
Notfinitenumberexception The object is not a valid member.
Notsupportedexception The called method is not implemented in the class.
Nullreferenceexception Try to use an unallocated reference
Outofmemoryexception Insufficient memory space
Platformnotsupportedexception This error is thrown when the platform does not support a specific attribute.
Stackoverflowexception Stack Overflow

 

 

Exception: The base class of all Exception objects.
Systemexception: The base class of all errors generated during the runtime.
Indexoutofrangeexception: It is triggered when the subscript of an array exceeds the range.
Nullreferenceexception: triggered when an empty object is referenced.
Invalidoperationexception: when a call to a method is invalid for the current state of the object, it is triggered by some methods.

argumentexception: The base class of all parameter exceptions.
argumentnullexception: If the parameter is null (not allowed), it is triggered by the method.
argumentoutofrangeexception: this parameter is thrown by a method when it is not within the specified range.
interopexception: The base class of the target exception in or outside the CLR environment.
comexception: an exception that contains the hresult information of the COM class.
sehexception: an exception that encapsulates Win32 structure exception handling information.
sqlexception: encapsulates SQL operation exceptions.

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.