Mono Class Library: System NamespaceSystem.DivideByZeroException Class |
See Also: DivideByZeroException Members
System.Object
System.Exception
System.SystemException
System.ArithmeticException
System.DivideByZeroException
|
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
Note:[Edit]The following CIL instructions throw DivideByZeroException:
- div
- div.un
- rem
- rem.un
The following example demonstrates an error that causes a DivideByZeroException exception.
C# Example using System; public class DivideZeroTest { public static void Main() { int x = 0; try { int y = 100/x; } catch (DivideByZeroException e) { Console.WriteLine("Error: {0}",e); } } }The output is
Example Error: System.DivideByZeroException: Attempted to divide by zero. at DivideZeroTest.Main()
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0