Check out example codes for "try catch c#". It will help you in understanding the concepts better.

Code Example 1

try
{
  int[] myNumbers = {1, 2, 3};
  Console.WriteLine(myNumbers[10]);
}
catch (Exception e)
{
  Console.WriteLine(e.Message);
}

Code Example 2

try 
{
  //  Block of code to try
}
catch (Exception e)
{
  //  Block of code to handle errors
}

Code Example 3

var person = {

    firstName: "John",

  lastName : "Doe",

    id       : 5566,

    fullName : function() {

      return this.firstName + " " + this.lastName;

    }

};

Learn ReactJs, React Native from akashmittal.com