As we mentioned previously, errors in C# programs are propagated at runtime using exceptions. When application code encounters an error, it throws an exception, which is then caught by another block of code that collects all the information about the exception and pushes it to the calling method, where the catch block was provided. A dialog box will be displayed by the system if you're using a generic exception handler for any uncaught exceptions.
In the following example, we are trying to parse an empty string into an int variable:
public static void ExceptionTest1(){ string str = string.Empty; int parseInt = int.Parse(str);}
When executed, the runtime throws a format exception with a message stating Input string was not ...