{"id":82,"date":"2008-06-23T11:48:30","date_gmt":"2008-06-23T15:48:30","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=82"},"modified":"2008-06-23T12:35:30","modified_gmt":"2008-06-23T16:35:30","slug":"c-attributes","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=82","title":{"rendered":"C# Attributes"},"content":{"rendered":"<p>Overview<br \/>\nAllow programmers to annotate various entities to be retrieved at runtime<\/p>\n<p>Reference<br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa664611(VS.71).aspx\">MSDN<\/a><\/p>\n<p>Attribute Classes<br \/>\n Inherites from abstract System.Attribute class<br \/>\n Use of suffix Attribute is preferred<br \/>\n Can have<br \/>\n  positional parameters (defined in public constructors)<br \/>\n  named parameters (public non-static read-write properties)<br \/>\n Example:<\/p>\n<pre lang=\"csharp\">using System;\r\n[AttributeUsage(AttributeTargets.Class)]\r\npublic class HelpAttribute: Attribute\r\n{\r\n   \/\/ Positional parameter\r\n   public HelpAttribute(string url) {\r\n      ...\r\n   }\r\n   \/\/ Named parameter\r\n   public string Topic {\r\n      get {...}\r\n      set {...}\r\n   }\r\n   public string Url {\r\n      get {...}\r\n   }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Overview Allow programmers to annotate various entities to be retrieved at runtime Reference MSDN Attribute Classes Inherites from abstract System.Attribute class Use of suffix Attribute is preferred Can have positional parameters (defined in public constructors) named parameters (public non-static read-write &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=82\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-c"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-1k","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=82"}],"version-history":[{"count":0,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/82\/revisions"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}