Files
TrainingAdvancedTechniques/Exceptionhandling/Program.cs
2019-01-09 22:54:31 +01:00

37 lines
838 B
C#

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
{
}
}
}
}