例外処理のメモ
namespace ConsoleApp1 { class MyException: Exception { public MyException(string msg): base(msg) { } } class Program { static void Div(int a, int b) { try { if (a == 0 | b == 0) { throw new MyException("0除算です"); } Console.WriteLine(a / b); } catch(MyException e) { Console.WriteLine(e.Message); } finally { Console.ReadLine(); } } static void Main(string[] args) { Div(10, 0); } } }