Thursday, 31 May 2018

Exception Handling in C# TRY CATCH STATEMENT









using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication35

{

    class Program

    {

        static void Main(string[] args)

        {

            int a;

            l1:

            Console.Write("Enter an integer number : ");

         

            try

            {

                a = int.Parse(Console.ReadLine());

                Console.WriteLine("value of a =" + a);

            }

            catch (Exception ex)

            {

                Console.ForegroundColor = System.ConsoleColor.Red;

                Console.WriteLine("------------Error--------\n"+ex);

                Console.ForegroundColor = System.ConsoleColor.White;

                Console.WriteLine("Press any key to go back.....");

                Console.ReadLine();

                goto l1;

            }

           

            Console.ReadLine();



        }

    }

}


No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...