{"id":3589,"date":"2020-08-04T23:28:55","date_gmt":"2020-08-04T14:28:55","guid":{"rendered":"https:\/\/okamurax.com\/?p=3589"},"modified":"2020-08-04T23:28:55","modified_gmt":"2020-08-04T14:28:55","slug":"c-%e4%be%8b%e5%a4%96%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=3589","title":{"rendered":"C# \u4f8b\u5916\u30e1\u30e2"},"content":{"rendered":"<p>Try\u53e5\u306e\u4e2d\u3067\u306f\u968e\u5c64\u304c\u6df1\u3044\u3068\u3053\u308d\u306e\u4f8b\u5916\u3067\u3082\u30ad\u30e3\u30c3\u30c1\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"lang:c# decode:true \">    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            try\r\n            {\r\n                new Test().TestMethod();\r\n            }\r\n            catch(Exception e)\r\n            {\r\n                MessageBox.Show(e.Message); \/\/ 0\u3067\u9664\u7b97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002\r\n            }\r\n        }\r\n    }\r\n\r\n    class Test\r\n    {\r\n        public void TestMethod()\r\n        {\r\n            new Test2();\r\n        }\r\n    }\r\n\r\n    class  Test2\r\n    {\r\n        public Test2()\r\n        {\r\n            int i = 0;\r\n            int ii = 1 \/ i;\r\n        }\r\n    }<\/pre>\n<p>Try\u53e5\u81ea\u4f53\u304c\u968e\u5c64\u306b\u306a\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u4e0a\u4f4d\u306b\u901a\u77e5\u3055\u308c\u306a\u3044\u3002<\/p>\n<pre class=\"lang:c# decode:true \">    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            try\r\n            {\r\n                new Test().TestMethod();\r\n            }\r\n            catch(Exception e)\r\n            {\r\n                MessageBox.Show(e.Message); \/\/ \u2460\r\n            }\r\n        }\r\n    }\r\n\r\n    class Test\r\n    {\r\n        public void TestMethod()\r\n        {\r\n            try\r\n            {\r\n                int i = 0;\r\n                int ii = 1 \/ i;\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                MessageBox.Show(e.Message); \/\/ \u2461\r\n                \/\/ 0\u3067\u9664\u7b97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002\r\n                \/\/ \u2460\u3067\u306f\u30ad\u30e3\u30c3\u30c1\u3055\u308c\u306a\u3044\r\n            }\r\n        }\r\n    }<\/pre>\n<p>\u4e0a\u4f4d\u306b\u901a\u77e5\u3059\u308b\u5834\u5408\u306fCatch\u53e5\u306e\u4e2d\u3067Throw\u3059\u308b\u3002<\/p>\n<pre class=\"lang:c# decode:true \">    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            try\r\n            {\r\n                new Test().TestMethod();\r\n            }\r\n            catch(Exception e)\r\n            {\r\n                MessageBox.Show(e.Message); \/\/ 0\u3067\u9664\u7b97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002\r\n            }\r\n        }\r\n    }\r\n\r\n    class Test\r\n    {\r\n        public void TestMethod()\r\n        {\r\n            try\r\n            {\r\n                int i = 0;\r\n                int ii = 1 \/ i;\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                MessageBox.Show(e.Message); \/\/ 0\u3067\u9664\u7b97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002\r\n                \r\n                throw; \/\/ \u3053\u308c\u3067\u30e1\u30c3\u30bb\u30fc\u30b8\u304c2\u5ea6\u8868\u793a\u3055\u308c\u308b\r\n\r\n            }\r\n        }\r\n    }<\/pre>\n<p>\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u6301\u3063\u3066\u4e0a\u4f4d\u306b\u901a\u77e5\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3002\u2460\u3001\u2461\u3068\u8868\u793a\u3055\u308c\u308b\u3002<\/p>\n<pre class=\"lang:c# decode:true \">    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            try\r\n            {\r\n                new Test().TestMethod();\r\n            }\r\n            catch(Exception e)\r\n            {\r\n                MessageBox.Show(\"\u2461\" + e.Message); \/\/ \u2461\u30a8\u30e9\u30fc\r\n            }\r\n        }\r\n    }\r\n\r\n    class Test\r\n    {\r\n        public void TestMethod()\r\n        {\r\n            try\r\n            {\r\n                int i = 0;\r\n                int ii = 1 \/ i;\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                MessageBox.Show(\"\u2460\" + e.Message); \/\/ \u24600\u3067\u9664\u7b97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002\r\n\r\n                throw new Exception(\"\u30a8\u30e9\u30fc\");\r\n            }\r\n        }\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Try\u53e5\u306e\u4e2d\u3067\u306f\u968e\u5c64\u304c\u6df1\u3044\u3068\u3053\u308d\u306e\u4f8b\u5916\u3067\u3082\u30ad\u30e3\u30c3\u30c1\u3067\u304d\u308b\u3002 public partial class Form1 : Form { public Form1() { InitializeComponent(); try  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=3589\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;C# \u4f8b\u5916\u30e1\u30e2&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9],"class_list":["post-3589","post","type-post","status-publish","format-standard","hentry","category-1","tag-c-net"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3589"}],"version-history":[{"count":1,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3589\/revisions"}],"predecessor-version":[{"id":3590,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3589\/revisions\/3590"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}