{"id":250,"date":"2014-05-31T16:35:39","date_gmt":"2014-05-31T07:35:39","guid":{"rendered":"http:\/\/gomocool.net\/gomokulog\/?p=250"},"modified":"2016-04-13T19:08:25","modified_gmt":"2016-04-13T10:08:25","slug":"%e3%83%87%e3%83%aa%e3%82%b2%e3%83%bc%e3%83%88delegate%e3%81%a8%e3%81%af%e3%81%aa%e3%82%93%e3%81%9e%e3%82%84","status":"publish","type":"post","link":"https:\/\/gomokulog.gomocool.net\/?p=250","title":{"rendered":"[C#] \u30c7\u30ea\u30b2\u30fc\u30c8(delegate)\u3068\u306f\u306a\u3093\u305e\u3084"},"content":{"rendered":"<p>\u5c0f\u96e3\u3057\u3044\u8b1b\u91c8\u3092\u7701\u3044\u3066\u3001\u3056\u3063\u304f\u308a\u8a00\u3046\u3068\u3001<strong>\u30c7\u30ea\u30b2\u30fc\u30c8\u3068\u306f\u95a2\u6570\u3092\u5165\u308c\u3089\u308c\u308b\u5909\u6570<\/strong>\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001Visual Studio \u3067\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3001hellow\u3068\u3060\u3051\u51fa\u529b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002(* .NetFramewokr4.0\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002)<\/p>\n<pre class=\"lang:c# decode:true\">using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace delegateConsole\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            string word;\r\n            word = \"hellow\";\r\n\r\n            Console.WriteLine(word);\r\n\r\n            Console.ReadLine(); \/\/stopper\r\n        }\r\n    }\r\n}<\/pre>\n<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306a\u306e\u3067\u3001static\u306aMain\u95a2\u6570\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002<\/p>\n<p>\u5909\u6570\u306b\u6587\u5b57\u3092\u5165\u308c\u3066\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3059\u308b\u3060\u3051\u3067\u3059\u3002<br \/>\nhellow\u3068\u3067\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u30c7\u30ea\u30b2\u30fc\u30c8\u3068\u306f\u95a2\u6570\u3092\u5165\u308c\u3089\u308c\u308b\u5909\u6570\u3067\u3059\u3002<br \/>\n\u306a\u306e\u3067\u3001\u95a2\u6570\u3092\u4f7f\u3046\u5f62\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:c# decode:true\">        static void Main(string[] args)\r\n        {\r\n            string word;\r\n            word = \"hellow\";\r\n\r\n            SayWord(word);\r\n\r\n            Console.ReadLine(); \/\/stopper\r\n        }\r\n\r\n        private static void SayWord(string word)\r\n        {\r\n            Console.WriteLine(word);\r\n        }<\/pre>\n<p>\u3082\u3061\u308d\u3093\u3001\u7d50\u679c\u306f\u4f55\u3082\u5909\u308f\u3089\u305a\u3001hellow\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u3044\u3088\u3044\u3088\u30c7\u30ea\u30b2\u30fc\u30c8\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:c# decode:true\">        private delegate void DelegateFunc(string _w);\r\n\r\n        static void Main(string[] args)\r\n        {\r\n            string word;\r\n            word = \"hellow\";\r\n\r\n            DelegateFunc myFunc = SayWord;\r\n            myFunc(word);\r\n\r\n            Console.ReadLine(); \/\/stopper\r\n        }\r\n\r\n        private static void SayWord(string word)\r\n        {\r\n            Console.WriteLine(word);\r\n        }<\/pre>\n<ol>\n<li>\u00a0\u95a2\u6570SayWord\u3068\u540c\u3058\u304fstring\u306e\u5f15\u6570\u3092\u3068\u308a\u3001void\u578b\u3092\u8fd4\u3059DelegateFunc\u578b\u3092\u4f5c\u3063\u3066\u3042\u3052\u308b\u3002(*\u578b\u540d\u306f\u3082\u3061\u308d\u3093\u306a\u3093\u3067\u3082\u826f\u3044\u3002)<\/li>\n<li>\u305d\u306eDelegateFunc\u578b\u306e\u5909\u6570myFunc\u3092\u5ba3\u8a00\u3057\u3066\u3001SayWord\u3092\u4ee3\u5165\u3059\u308b\u3002<\/li>\n<li>myFunc\u3092SayWord\u306e\u3088\u3046\u306b\u4f7f\u3046\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u3002\u3053\u308c\u3060\u3051\u3002<br \/>\n\u578b\u3092\u4f5c\u308b\u3068\u3044\u3046\u306e\u304c\u30d4\u30f3\u3068\u6765\u306a\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u30af\u30e9\u30b9\u3084\u69cb\u9020\u4f53\u3092\u4f5c\u308b\u6642\u3068\u540c\u3058\u3060\u3068\u8003\u3048\u308c\u3070\u666e\u901a\u3060\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u8907\u6570\u306e\u95a2\u6570\u3092\u4ee3\u5165\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"lang:c# decode:true\">        private delegate void DelegateFunc(string _w);\r\n\r\n        static void Main(string[] args)\r\n        {\r\n            string word;\r\n            word = \"hellow\";\r\n\r\n            DelegateFunc myFunc;\r\n            myFunc = SayWord;\r\n            myFunc += SayWordWord;\r\n            \r\n            myFunc(word);\r\n\r\n            Console.ReadLine(); \/\/stopper\r\n        }\r\n\r\n        private static void SayWord(string word)\r\n        {\r\n            Console.WriteLine(word);\r\n        }\r\n     \r\n        private static void SayWordWord(string word)\r\n        {\r\n            word = word + word;\r\n            Console.WriteLine(word);\r\n        }<\/pre>\n<p>\u95a2\u6570\u3092\u8ffd\u52a0\u3057\u305f\u3044\u5834\u5408\u3001+=\u3067\u8ffd\u52a0\u3067\u304d\u308b\u3002<br \/>\n\u5b9f\u884c\u7d50\u679c\u306f\u3001<\/p>\n<pre class=\"lang:batch decode:true\">hello\r\nhellohello<\/pre>\n<p>&nbsp;<\/p>\n<p>\u3055\u3066\u3001\u300c\u30c7\u30ea\u30b2\u30fc\u30c8\u3068\u306f\u4f55\u304b\u300d\u3056\u3063\u304f\u308a\u3060\u304c\u3001\u5206\u304b\u3063\u305f\u3093\u3058\u3083\u306a\u304b\u308d\u3046\u304b\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u3044\u3064\u3001\u4f7f\u3046\u306e\u304b\u3002<\/p>\n<p>\u805e\u3044\u305f\u3053\u3068\u304c\u3042\u308b\u306f\u305a\u3067\u3059\u3002<br \/>\n\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3002<br \/>\n\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3002<\/p>\n<p>\u3044\u3084\u3001\u3080\u3057\u308d\u3001\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u8abf\u3079\u308b\u3046\u3061\u306b<br \/>\n\u300c\u3066\u304b\u3001\u30c7\u30ea\u30b2\u30fc\u30c8\u3063\u3066\u306a\u3093\u305e\u3002\u300d\u3063\u3066\u3053\u3068\u3067\u3053\u306e\u30da\u30fc\u30b8\u3092\u898b\u3066\u308b\u304b\u3082\uff1f<\/p>\n<p>\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u306f\u3001\u300c\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u300d\u300c\u6642\u9593\u304c\u6765\u305f\u300d\u306a\u3069\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30a4\u30d9\u30f3\u30c8\u3068\u3057\u3066\u3001\u53d7\u3051\u53d6\u3063\u3066\u51e6\u7406\u3092\u884c\u3046\u4ed5\u7d44\u307f\u3067\u3059\u3002<br \/>\n\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u3001\u300c\u547c\u3073\u623b\u3059\u300d\u3002\u3064\u307e\u308a\u5225\u306e\u6d41\u308c\u304b\u3089\u3001\u547c\u3073\u623b\u3059\u95a2\u6570\u306e\u3053\u3068\u3092\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3068\u304b\u8a00\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\u3053\u306e\u8fba\u308a\u306e\u8a00\u8449\u306e\u5b9a\u7fa9\u306f\u3068\u3082\u304b\u304f\u3001\u3069\u3063\u3061\u3082\u3084\u3063\u3066\u308b\u3053\u3068\u306f\u3001\u30c7\u30ea\u30b2\u30fc\u30c8\u306b\u95a2\u6570\u3092\u899a\u3048\u3055\u305b\u3066\u4f7f\u3063\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<br \/>\ndelegate\u3092\u30aa\u30ea\u30b8\u30ca\u30eb\u3067\u4f5c\u3063\u3066\u3001\u4f7f\u3046\u3063\u3066\u3053\u3068\u306f\u3042\u307e\u308a\u7121\u3044\u3067\u3059\u304c\u3001\u3053\u306e\u95a2\u6570\u3092\u4ee3\u5165\u3059\u308b\u3068\u3044\u3046\u611f\u899a\u306f\u3001\u77e5\u3063\u3066\u304a\u3044\u305f\u307b\u3046\u304c\u826f\u3055\u3052\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6c17\u304c\u5411\u3044\u305f\u3089\u4eca\u5ea6\u306f\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3042\u305f\u308a\u3092\u3061\u3087\u3063\u3068\u3060\u3051\u66f8\u304f\u304b\u3082\u3002<\/p>\n<p>\u8ffd\u8a18\uff1a<a title=\"[C#]\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3068\u306f\u306a\u3093\u305e\u3084\" href=\"http:\/\/gomocool.net\/gomokulog\/?p=255\">\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3068\u306f\u306a\u3093\u305e\u3084<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u96e3\u3057\u3044\u8b1b\u91c8\u3092\u7701\u3044\u3066\u3001\u3056\u3063\u304f\u308a\u8a00\u3046\u3068\u3001\u30c7\u30ea\u30b2\u30fc\u30c8\u3068\u306f\u95a2\u6570\u3092\u5165\u308c\u3089\u308c\u308b\u5909\u6570\u3067\u3059\u3002 \u3067\u306f\u3001Visual Studio \u3067\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3001hellow\u3068\u3060\u3051\u51fa\u529b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002(* .NetF&hellip;  <a href=\"https:\/\/gomokulog.gomocool.net\/?p=250\" class=\"more-link\">more <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66,20],"tags":[59],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-dot-net","category-csharp","tag-delegate--"],"_links":{"self":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=250"}],"version-history":[{"count":5,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":748,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/250\/revisions\/748"}],"wp:attachment":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}