﻿
{"id":5704,"date":"2017-02-28T05:48:23","date_gmt":"2017-02-28T05:48:23","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=5704"},"modified":"2017-02-28T05:48:23","modified_gmt":"2017-02-28T05:48:23","slug":"c-attribute-yapilarinda-x-is-not-a-valid-named-attribute-argument-because-it-is-not-a-valid-attribute-parameter-type-hatasi-ve-cozumu","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/c-attribute-yapilarinda-x-is-not-a-valid-named-attribute-argument-because-it-is-not-a-valid-attribute-parameter-type-hatasi-ve-cozumu\/","title":{"rendered":"C# Attribute Yap\u0131lar\u0131nda &#8220;&#8216;X&#8217; Is Not A Valid Named Attribute Argument Because It Is Not A Valid Attribute Parameter Type&#8221; Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>C#&#8217;ta attribute yap\u0131lar\u0131nda \u00e7al\u0131\u015f\u0131yorken &#8220;<em>&#8216;X&#8217; Is Not A Valid Named Attribute Argument Because It Is Not A Valid Attribute Parameter Type<\/em>&#8221; hatas\u0131yla kar\u015f\u0131la\u015ft\u0131ysan\u0131z e\u011fer bu i\u00e7eri\u011fimizde ilgili hatan\u0131n nedeni ve \u00e7\u00f6z\u00fcm\u00fc hakk\u0131nda bilgi bulabileceksiniz.<\/p>\n<p>\u015eimdi hi\u00e7 vakit kaybetmeden bir \u00f6rnek \u00fczerinden konuya giri\u015f yapal\u0131m.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    class OrnekAttribute : Attribute\r\n    {\r\n        public string X { get; set; }\r\n        public int Y { get; set; }\r\n        public SqlConnection Z { get; set; }\r\n    }\r\n<\/pre>\n<p>G\u00f6rd\u00fc\u011f\u00fcn\u00fcz \u00fczere, yukar\u0131daki kod blo\u011funda bir attribute tan\u0131mlanm\u0131\u015ft\u0131r. Bu attribute i\u00e7erisinde string, int ve SqlConnection tipinden olmak olmak \u00fczere \u00fc\u00e7 adet property tan\u0131mlanm\u0131\u015ft\u0131r.<\/p>\n<p>Tan\u0131mlanan bu niteli\u011fi a\u015fa\u011f\u0131daki \u015fekilde kullanmaya \u00e7al\u0131\u015ft\u0131\u011f\u0131m\u0131zda g\u00f6rece\u011finiz \u00fczere i\u00e7eri\u011fimizin konusu olan hatayla kar\u015f\u0131la\u015fmaktay\u0131z.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/C-Attribute-Yap\u0131lar\u0131nda-X-Is-Not-A-Valid-Named-Attribute-Argument-Because-It-Is-Not-A-Valid-Attribute-Parameter-Type-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5707\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/C-Attribute-Yap\u0131lar\u0131nda-X-Is-Not-A-Valid-Named-Attribute-Argument-Because-It-Is-Not-A-Valid-Attribute-Parameter-Type-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc.png\" alt=\"C# Attribute Yap\u0131lar\u0131nda &quot;'X' Is Not A Valid Named Attribute Argument Because It Is Not A Valid Attribute Parameter Type&quot; Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"552\" height=\"167\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/C-Attribute-Yap\u0131lar\u0131nda-X-Is-Not-A-Valid-Named-Attribute-Argument-Because-It-Is-Not-A-Valid-Attribute-Parameter-Type-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc.png 552w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/C-Attribute-Yap\u0131lar\u0131nda-X-Is-Not-A-Valid-Named-Attribute-Argument-Because-It-Is-Not-A-Valid-Attribute-Parameter-Type-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-300x91.png 300w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><\/a><\/p>\n<p><strong>Peki bu hatayla neden kar\u015f\u0131la\u015fmaktay\u0131z?<\/strong> sorusuna gelirsek e\u011fer attribute yap\u0131lar\u0131yla ilgili bir ka\u00e7 bilgi eksikli\u011fini cevap olarak sunmam\u0131z yeterli olacakt\u0131r.<\/p>\n<p>Attributelarda kullanaca\u011f\u0131n\u0131z parametrelerde bilmeniz gereken hususlar \u015funlard\u0131r;<\/p>\n<ul>\n<li><strong>De\u011fer tipli olabilirler<\/strong><br \/>\nbool, int, string, char, decimal, double vs&#8230;<\/li>\n<li><strong>System.Type tipinden olabilirler<\/strong><br \/>\n\u00d6rne\u011fin;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    class OrnekAttribute : Attribute\r\n    {\r\n        public string X { get; set; }\r\n        public int Y { get; set; }\r\n        public Type Z { get; set; }\r\n    }\r\n<\/pre>\n<p>Kullan\u0131rkende;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    &#x5B;Ornek(X = &quot;&quot;, Y = 0, Z = typeof(SqlConnection))]\r\n<\/pre>\n<p>\u015feklinde \u00e7a\u011fr\u0131labilirler.<\/li>\n<li><strong>Enums(Enumaration) olabilirler<\/strong><br \/>\n\u00d6rne\u011fin;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    class OrnekAttribute : Attribute\r\n    {\r\n        public string X { get; set; }\r\n        public int Y { get; set; }\r\n        public OrnekEnum Z { get; set; }\r\n    }\r\n\r\n    enum OrnekEnum\r\n    {\r\n        x, y, z\r\n    }\r\n<\/pre>\n<p>Kullan\u0131rkende;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    &#x5B;Ornek(X = &quot;&quot;, Y = 0, Z = OrnekEnum.y)]\r\n<\/pre>\n<p>\u015feklinde \u00e7a\u011fr\u0131labilirler.<\/li>\n<li><strong>Object tipte olabilirler<\/strong><\/li>\n<li><strong>Yukar\u0131da bahsedilen t\u00fcr ve tiplerden herhangi birisinin tek boyutlu dizisi olabilirler.<\/strong><\/li>\n<\/ul>\n<blockquote><p><em>Ama gelin g\u00f6r\u00fcn ki, bir attributeun parametresi referans tipinden, \u00e7ok boyutlu bir diziden yahut yukar\u0131daki verilen t\u00fcrlerin d\u0131\u015f\u0131ndan olamaz! ! !<\/em><\/p><\/blockquote>\n<p>\u0130\u015fte bu g\u00f6z ard\u0131 edilen bilgiler y\u00fcz\u00fcnden ilgili hatayla kar\u015f\u0131la\u015fabilirsiniz.<\/p>\n<p>Umar\u0131m derdinize derman niteli\u011finde olmu\u015ftur \ud83d\ude42<\/p>\n<p>Sonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, C#&#8217;ta attribute yap\u0131lar\u0131nda \u00e7al\u0131\u015f\u0131yorken &#8220;&#8216;X&#8217; Is Not A Valid Named Attribute Argument Because It Is Not A Valid Attribute Parameter Type&#8221; hatas\u0131yla kar\u015f\u0131la\u015ft\u0131ysan\u0131z e\u011fer bu i\u00e7eri\u011fimizde ilgili hatan\u0131n nedeni ve \u00e7\u00f6z\u00fcm\u00fc hakk\u0131nda bilgi&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":3223,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,258],"tags":[313,27,1639,1640,1638,260,849,1561,1637],"class_list":["post-5704","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-sharp-c","category-hata-cozumleri","tag-attribute","tag-c","tag-c-hata-cozumleri","tag-c-hatalari","tag-c-nitelikler","tag-hata","tag-hata-cozumleri","tag-hata-ve-cozumleri","tag-nitelikler"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/5704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=5704"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/5704\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/3223"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=5704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=5704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=5704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}