{"id":204,"date":"2015-05-20T23:04:53","date_gmt":"2015-05-20T20:04:53","guid":{"rendered":"https:\/\/gokhan-gokalp.com\/?p=204"},"modified":"2023-03-14T23:13:42","modified_gmt":"2023-03-14T22:13:42","slug":"c-runtime-ortaminda-kod-derleme","status":"publish","type":"post","link":"https:\/\/gokhan-gokalp.com\/tr\/c-runtime-ortaminda-kod-derleme\/","title":{"rendered":"C# runtime ortam\u0131nda kod derleme"},"content":{"rendered":"<p>Bazen\u00a0<strong>runtime<\/strong> esnas\u0131nda bir kodu derleyip \u00e7\u0131kt\u0131s\u0131n\u0131 elde etmek isteyebiliriz, en az\u0131ndan benim ba\u015f\u0131ma geldi. :) Bir projemde bana <strong>string<\/strong> olarak gelen bir de\u011feri, \u00f6rne\u011fin &#8220;DateTime.Now()&#8221;, runtime esnas\u0131nda derleyip \u00e7\u0131kt\u0131s\u0131n\u0131 elde etmem gerekti.<\/p>\n<p>Nas\u0131l yapabilece\u011fimize dair \u00f6rne\u011fe a\u015fa\u011f\u0131da bakabilir, ihtiyac\u0131n\u0131za g\u00f6re d\u00fczenleyebilirsiniz.<\/p>\n<p>Selametle&#8230;<\/p>\n<pre class=\"lang:c# decode:true\">            \/\/ Compile edece\u011fimiz \u00f6rnek kodumuz.\r\n            string code = @\"\r\n                            using System;\r\n            \r\n                            namespace CompileCore\r\n                            {                \r\n                                public class CompileHelper\r\n                                {                \r\n                                    public static string CompileDateTime()\r\n                                    {\r\n                                        return DateTime.Now.ToString(\"\"dd.MM.yyyy HH:mm:ss\"\");\r\n                                    }\r\n                                }\r\n                            }\r\n                        \";\r\n\r\n            CSharpCodeProvider provider = new CSharpCodeProvider();\r\n\r\n            \/\/ System.CodeDom.Compiler namespace'inin alt\u0131nda bulunmaktad\u0131r.\r\n            CompilerResults results = provider.CompileAssemblyFromSource(new CompilerParameters(), code);\r\n\r\n            Type binaryFunction = results.CompiledAssembly.GetType(\"CompileCore.CompileHelper\");\r\n\r\n            \/\/ Gerisi bir ufak reflection kodu ile ilglil metotu al\u0131p delegate arac\u0131l\u0131\u011f\u0131 ile \u00e7a\u011f\u0131r\u0131yoruz.\r\n            var mInfo = binaryFunction.GetMethod(\"CompileDateTime\");\r\n\r\n            var funcDelegate = (Func&lt;string&gt;)Delegate.CreateDelegate(typeof(Func&lt;string&gt;), mInfo);\r\n\r\n            return funcDelegate();<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Bazen\u00a0runtime esnas\u0131nda bir kodu derleyip \u00e7\u0131kt\u0131s\u0131n\u0131 elde etmek isteyebiliriz, en az\u0131ndan benim ba\u015f\u0131ma geldi. :) Bir projemde bana string olarak gelen bir de\u011feri, \u00f6rne\u011fin &#8220;DateTime.Now()&#8221;, runtime esnas\u0131nda derleyip \u00e7\u0131kt\u0131s\u0131n\u0131 elde etmem gerekti. Nas\u0131l yapabilece\u011fimize dair \u00f6rne\u011fe a\u015fa\u011f\u0131da bakabilir, ihtiyac\u0131n\u0131za g\u00f6re d\u00fczenleyebilirsiniz. Selametle&#8230; \/\/ Compile edece\u011fimiz&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/gokhan-gokalp.com\/tr\/c-runtime-ortaminda-kod-derleme\/\">Devam\u0131n\u0131 okuyun<span class=\"screen-reader-text\">C# runtime ortam\u0131nda kod derleme<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[39,40],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-net","tag-c-runtime","tag-runtime-kod-derleme","entry"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"tr","enabled_languages":["en","tr"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"tr":{"title":false,"content":false,"excerpt":false}}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C# runtime ortam\u0131nda kod derleme - G\u00f6khan G\u00f6kalp<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C# runtime ortam\u0131nda kod derleme - G\u00f6khan G\u00f6kalp\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/\" \/>\n<meta property=\"og:site_name\" content=\"G\u00f6khan G\u00f6kalp\" \/>\n<meta property=\"article:published_time\" content=\"2015-05-20T20:04:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-14T22:13:42+00:00\" \/>\n<meta name=\"author\" content=\"G\u00f6khan G\u00f6kalp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"G\u00f6khan G\u00f6kalp\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/\"},\"author\":{\"name\":\"G\u00f6khan G\u00f6kalp\",\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/#\\\/schema\\\/person\\\/7e2a7fa98babd22a5fdae563c4b8cdbe\"},\"headline\":\"C# runtime ortam\u0131nda kod derleme\",\"datePublished\":\"2015-05-20T20:04:53+00:00\",\"dateModified\":\"2023-03-14T22:13:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/\"},\"wordCount\":68,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/#\\\/schema\\\/person\\\/7e2a7fa98babd22a5fdae563c4b8cdbe\"},\"keywords\":[\"c# runtime\",\"runtime kod derleme\"],\"articleSection\":[\".NET\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/\",\"url\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/\",\"name\":\"C# runtime ortam\u0131nda kod derleme - G\u00f6khan G\u00f6kalp\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/#website\"},\"datePublished\":\"2015-05-20T20:04:53+00:00\",\"dateModified\":\"2023-03-14T22:13:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/c-runtime-ortaminda-kod-derleme\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gokhan-gokalp.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C# runtime ortam\u0131nda kod derleme\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/#website\",\"url\":\"https:\\\/\\\/gokhan-gokalp.com\\\/\",\"name\":\"G\u00f6khan G\u00f6kalp\",\"description\":\"C# &amp; Python lover\",\"publisher\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/#\\\/schema\\\/person\\\/7e2a7fa98babd22a5fdae563c4b8cdbe\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gokhan-gokalp.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/#\\\/schema\\\/person\\\/7e2a7fa98babd22a5fdae563c4b8cdbe\",\"name\":\"G\u00f6khan G\u00f6kalp\",\"pronouns\":\"he\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/wp-content\\\/litespeed\\\/avatar\\\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659\",\"url\":\"https:\\\/\\\/gokhan-gokalp.com\\\/wp-content\\\/litespeed\\\/avatar\\\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659\",\"contentUrl\":\"https:\\\/\\\/gokhan-gokalp.com\\\/wp-content\\\/litespeed\\\/avatar\\\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659\",\"caption\":\"G\u00f6khan G\u00f6kalp\"},\"logo\":{\"@id\":\"https:\\\/\\\/gokhan-gokalp.com\\\/wp-content\\\/litespeed\\\/avatar\\\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659\"},\"sameAs\":[\"https:\\\/\\\/gokhan-gokalp.com\"],\"url\":\"https:\\\/\\\/gokhan-gokalp.com\\\/tr\\\/author\\\/gok-gokalp\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C# runtime ortam\u0131nda kod derleme - G\u00f6khan G\u00f6kalp","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/","og_locale":"tr_TR","og_type":"article","og_title":"C# runtime ortam\u0131nda kod derleme - G\u00f6khan G\u00f6kalp","og_url":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/","og_site_name":"G\u00f6khan G\u00f6kalp","article_published_time":"2015-05-20T20:04:53+00:00","article_modified_time":"2023-03-14T22:13:42+00:00","author":"G\u00f6khan G\u00f6kalp","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"G\u00f6khan G\u00f6kalp","Tahmini okuma s\u00fcresi":"1 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/#article","isPartOf":{"@id":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/"},"author":{"name":"G\u00f6khan G\u00f6kalp","@id":"https:\/\/gokhan-gokalp.com\/#\/schema\/person\/7e2a7fa98babd22a5fdae563c4b8cdbe"},"headline":"C# runtime ortam\u0131nda kod derleme","datePublished":"2015-05-20T20:04:53+00:00","dateModified":"2023-03-14T22:13:42+00:00","mainEntityOfPage":{"@id":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/"},"wordCount":68,"commentCount":2,"publisher":{"@id":"https:\/\/gokhan-gokalp.com\/#\/schema\/person\/7e2a7fa98babd22a5fdae563c4b8cdbe"},"keywords":["c# runtime","runtime kod derleme"],"articleSection":[".NET"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/","url":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/","name":"C# runtime ortam\u0131nda kod derleme - G\u00f6khan G\u00f6kalp","isPartOf":{"@id":"https:\/\/gokhan-gokalp.com\/#website"},"datePublished":"2015-05-20T20:04:53+00:00","dateModified":"2023-03-14T22:13:42+00:00","breadcrumb":{"@id":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gokhan-gokalp.com\/c-runtime-ortaminda-kod-derleme\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gokhan-gokalp.com\/"},{"@type":"ListItem","position":2,"name":"C# runtime ortam\u0131nda kod derleme"}]},{"@type":"WebSite","@id":"https:\/\/gokhan-gokalp.com\/#website","url":"https:\/\/gokhan-gokalp.com\/","name":"G\u00f6khan G\u00f6kalp","description":"C# &amp; Python lover","publisher":{"@id":"https:\/\/gokhan-gokalp.com\/#\/schema\/person\/7e2a7fa98babd22a5fdae563c4b8cdbe"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gokhan-gokalp.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/gokhan-gokalp.com\/#\/schema\/person\/7e2a7fa98babd22a5fdae563c4b8cdbe","name":"G\u00f6khan G\u00f6kalp","pronouns":"he","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/gokhan-gokalp.com\/wp-content\/litespeed\/avatar\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659","url":"https:\/\/gokhan-gokalp.com\/wp-content\/litespeed\/avatar\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659","contentUrl":"https:\/\/gokhan-gokalp.com\/wp-content\/litespeed\/avatar\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659","caption":"G\u00f6khan G\u00f6kalp"},"logo":{"@id":"https:\/\/gokhan-gokalp.com\/wp-content\/litespeed\/avatar\/e645f66b6264ced10d7b6d8b1f85509b.jpg?ver=1776170659"},"sameAs":["https:\/\/gokhan-gokalp.com"],"url":"https:\/\/gokhan-gokalp.com\/tr\/author\/gok-gokalp\/"}]}},"_links":{"self":[{"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/comments?post=204"}],"version-history":[{"count":6,"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"predecessor-version":[{"id":4357,"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/posts\/204\/revisions\/4357"}],"wp:attachment":[{"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gokhan-gokalp.com\/tr\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}