Errors and Exceptions Handling In C#

Errors in C#

There are three types of errors in C# that can be occur in your application. These are:- • Syntax Errors • Runtime Errors or Exceptions • Logical Errors System Errors Syntax errors occur due to ill-formed codes. The cause can be a misspelled keyword, improperly constructed statements, absence of punctuations, such as line terminators, etc. …

Errors in C# Read More »

Exceptions In C#

System.Exception is the base class for all other exceptions. Below this level are the System.ApplicationException and System.SystemException classes which are derived from the System.Exception class.     The SystemException class acts as the base class for all the pre-defined Exceptions. ApplicationException class is to be used for any custom exceptions that you are to create …

Exceptions In C# Read More »

Creating Custom Exceptions In C#

User defined exceptions can be created by deriving from the System.ApplicationException class or from any other system defined class. You can also derive Exceptions from these user-defined classes. The ultimate thing is that the new Exception class should be derived (directly or indirectly) from the Exception class.   class MyException : ApplicationException { public MyException(string …

Creating Custom Exceptions In C# Read More »

Scroll to Top