{"id":1213,"date":"2020-04-15T18:53:33","date_gmt":"2020-04-15T06:53:33","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1213"},"modified":"2020-04-15T18:54:01","modified_gmt":"2020-04-15T06:54:01","slug":"the-delegate-type","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1213","title":{"rendered":"The Delegate Type"},"content":{"rendered":"<h1>Definition<\/h1>\n<p>Delegate is a type that references methods with a particular parameter list and return type.<\/p>\n<h1>Printer Custom Delegate<\/h1>\n<pre style=\"white-space: pre;\">public delegate void Printer&lt;T&gt;(T data);<\/pre>\n<h1>A Method for Printer Delegate<\/h1>\n<pre style=\"white-space: pre;\">static void ConsoleWrite&lt;T&gt;(T data) {\r\n    Console.WriteLine(data);\r\n}<\/pre>\n<h1>Reference the ConsoleWrite method with Printer delegate<\/h1>\n<div>\n<pre style=\"white-space: pre;\">Printer&lt;String&gt;\u00a0consoleOut\u00a0=\u00a0new\u00a0Printer&lt;String&gt;(ConsoleWrite);\r\nconsoleOut(\"test\");<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Definition Delegate is a type that references methods with a particular parameter list and return type. Printer Custom Delegate public delegate void Printer&lt;T&gt;(T data); A Method for Printer Delegate static void ConsoleWrite&lt;T&gt;(T data) { Console.WriteLine(data); } Reference the ConsoleWrite method with Printer delegate Printer&lt;String&gt;\u00a0consoleOut\u00a0=\u00a0new\u00a0Printer&lt;String&gt;(ConsoleWrite); consoleOut(&#8220;test&#8221;); &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[53],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1213"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1213"}],"version-history":[{"count":2,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1213\/revisions"}],"predecessor-version":[{"id":1215,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1213\/revisions\/1215"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}