try and catch Statements

You can handle errors by using a try…catch statement. You wrap the code that you suspect to trigger an error inside a try block. The catch block contains the codes to be executed when an error is encountered. The following program demonstrates using try…catchstatements. using System; namespace Read more