What is Exception Handling?

1/9/2020 12:00:00 AM

When we handling the exception then we use the try catch block. Under the block the unwanted exception handle so program doesn’t stop it smoothly run by the is Exception Handling using try catch block. Now given bellow the example code and explain the code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Reflection;
using testForClass1;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace testFor
    public class Program
        static void Main(string[] args)
                Console.WriteLine("Enter Number : ");
                int num =Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("This is int value "+num);
            catch (Exception ex)
                Console.WriteLine("This is not int value");

In this code we use Exception Handle by the try catch. When value type is match then go to try block and execute the code otherwise go to catch block and  execute catch block code.