I am trying to handle DivideByZeroExeption in C# but the code do not catch the exeption, the Console print result of 10 / d is ∞
double d = 0;
try
{
double value = 10 / d;
Console.WriteLine(value);
}
catch (DivideByZeroException e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Ignore...");
}
enter image description here But when I changed type of d from double to int or long, this code above works normally.