Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

C# Exception Handling

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExceptionHandling
{
    class Program
    {
        /* 
         * try and catch
         * الاخطاء
         */
        static void Main(string[] args)
        {
            try
            {
                int a = 80, b = 0;
                double c = a / b;
                Console.WriteLine(c);
            }
            catch (DivideByZeroException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            catch
            {
                Console.WriteLine("from catch : noooooooo");
            }
            finally
            {
                Console.WriteLine("from finally : noooooooo");
            }

            Console.ReadKey();
        }
    }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.