Started Exceptionhandling

This commit is contained in:
2019-01-09 22:54:31 +01:00
parent 8307f4b50c
commit 7b3e8c17c2
6 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exceptionhandling
{
class Program
{
static void Main(string[] args)
{
try
{
var calculator = new Calculator();
var result = calculator.Divide(5, 0);
}
catch (DivideByZeroException dx)
{
Console.WriteLine("You cannot divide by 0.");
}
catch (ArithmeticException ax)
{
Console.WriteLine("");
}
catch (Exception ex)
{
Console.WriteLine("Sorry, an unexpected error occured. :" + ex.Message);
}
finally
{
}
}
}
}