void onメインウィンドウ破棄前(引数型 arg, 返値型 ret)public static void onメインウィンドウ破棄前(引数型 arg, 返値型 ret) { } argなし retなし タイミング
一般的用途
例① 初期化に適しているstatic string fileName = "aaa.txt"; public static void onメインウィンドウ生成後(引数型 arg, 返値型 ret) { try { using (StreamWriter sw = new StreamWriter(fileName, false)) { sw.WriteLine("Hello, World!"); } } catch (Exception e) { MessageBox.Show(e.Message); } } public static void onメインウィンドウ破棄前(引数型 arg, 返値型 ret) { try { if (File.Exists(fileName)) { File.Delete(fileName); } } catch (Exception e) { MessageBox.Show(e.Message); } } |