/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System/Exception/Overview/csharp/catchexception.cs
30 строк
583 B
Genevieve Warren
Remarks for exception types and Registry class (#38930)
03 янв 2024, 22:30
Не верифицирован
03 янв 2024, 22:30
932bcca
Код
Авторство
О чём код?
//<Snippet1> using System; class ExceptionTestClass { public static void Main() { int x = 0; try { int y = 100 / x; } catch (ArithmeticException e) { Console.WriteLine($"ArithmeticException Handler: {e}"); } catch (Exception e) { Console.WriteLine($"Generic Exception Handler: {e}"); } } } /* This code example produces the following results: ArithmeticException Handler: System.DivideByZeroException: Attempted to divide by zero. at ExceptionTestClass.Main() */ //</Snippet1>