Csharp/C Sharp by API/System/DivideByZeroException
DivideByZeroException.Message
using System;
public class MainClass
{
public static void Main()
{
try
{
int zero = 0;
Console.WriteLine("In try block: attempting division by zero");
int myInt = 1 / zero; // throws the exception
}
catch (DivideByZeroException myException)
{
// code that handles a DivideByZeroException
Console.WriteLine("Message = " + myException.Message);
Console.WriteLine("StackTrace = " + myException.StackTrace);
}
}
}