Csharp/C Sharp by API/System/DivideByZeroException
Версия от 18:31, 26 мая 2010; (обсуждение)
DivideByZeroException.Message
<source lang="csharp"> 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); } }
}
</source>