{"id":277,"date":"2011-09-21T17:57:41","date_gmt":"2011-09-21T17:57:41","guid":{"rendered":"http:\/\/madprogrammer76.wordpress.com\/?p=277"},"modified":"2011-09-21T17:57:41","modified_gmt":"2011-09-21T17:57:41","slug":"shortcut-to-creating-properties-in-c-sharp-revisited","status":"publish","type":"post","link":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/","title":{"rendered":"Shortcut To Creating Properties in C-Sharp &#8211; Revisited"},"content":{"rendered":"<p>Based on my earlier an <a href=\"http:\/\/unlatched.com\/blog_Shortcut_To_Creating_Properties_in_C-Sharp.aspx\" title=\"Shortcut To Creating Properties in C-Sharp\">post<\/a>, a I had a question about my technique and if there was a benefit, or could you use MethodBase.GetCurrentMethod().Name.  Truthfully I did not know the answer until I tried it.  I found this new way works, but I also find it is a little tougher to look at style-wise.  You need to use stack frames if you nest the routine like I had in my original post.<\/p>\n<pre style=\"background-color:#ffffcc;font-size:.9em;border:dashed 1px silver;\">\npublic class ErrorLogRecord\n    {\n        public Hashtable _hsh = new Hashtable();\n\n        public DateTime DateOfOccurance\n        {\n            get { return (DateTime?)_hsh[MethodBase.GetCurrentMethod().Name.Replace(\"set_\", \"\").Replace(\"get_\", \"\")] ?? DateTime.Now; }\n            set { _hsh[MethodBase.GetCurrentMethod().Name.Replace(\"set_\", \"\").Replace(\"get_\", \"\")] = value; }\n        }\n        public String ErrorText\n        {\n            get { return (String)_hsh[MethodBase.GetCurrentMethod().Name.Replace(\"set_\", \"\").Replace(\"get_\", \"\")]; }\n            set { _hsh[MethodBase.GetCurrentMethod().Name.Replace(\"set_\", \"\").Replace(\"get_\", \"\")] = value; }\n        }\n    }\n<\/pre>\n<p><strong>Original Referenec<\/strong> <a href=\"http:\/\/unlatched.com\/blog_Shortcut_To_Creating_Properties_in_C-Sharp.aspx\">Shortcut To Creating Properties in C-Sharp<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Based on my earlier an post, a I had a question about my technique and if there was a benefit, or could you use MethodBase.GetCurrentMethod().Name. Truthfully I did not know the answer until I tried it. I found this new way works, but I also find it is a little tougher to look at style-wise. &hellip; <a href=\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Shortcut To Creating Properties in C-Sharp &#8211; Revisited<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,23,24,25,36,37],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Shortcut To Creating Properties in C-Sharp - Revisited - LDNDeveloper<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Shortcut To Creating Properties in C-Sharp - Revisited - LDNDeveloper\" \/>\r\n<meta property=\"og:description\" content=\"Based on my earlier an post, a I had a question about my technique and if there was a benefit, or could you use MethodBase.GetCurrentMethod().Name. Truthfully I did not know the answer until I tried it. I found this new way works, but I also find it is a little tougher to look at style-wise. &hellip; Continue reading Shortcut To Creating Properties in C-Sharp &#8211; Revisited\" \/>\r\n<meta property=\"og:url\" content=\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\" \/>\r\n<meta property=\"og:site_name\" content=\"LDNDeveloper\" \/>\r\n<meta property=\"article:published_time\" content=\"2011-09-21T17:57:41+00:00\" \/>\r\n<meta name=\"author\" content=\"andrewpallant\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@ldnDeveloper\" \/>\r\n<meta name=\"twitter:site\" content=\"@LdnDeveloper\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"andrewpallant\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\"},\"author\":{\"name\":\"andrewpallant\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97\"},\"headline\":\"Shortcut To Creating Properties in C-Sharp &#8211; Revisited\",\"datePublished\":\"2011-09-21T17:57:41+00:00\",\"dateModified\":\"2011-09-21T17:57:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\"},\"wordCount\":91,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"articleSection\":[\"C#\",\"Deployment\",\"Developer\",\"DotNet\",\"How To\",\"Ideas\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\",\"url\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\",\"name\":\"Shortcut To Creating Properties in C-Sharp - Revisited - LDNDeveloper\",\"isPartOf\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#website\"},\"datePublished\":\"2011-09-21T17:57:41+00:00\",\"dateModified\":\"2011-09-21T17:57:41+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/andrewpallant.ca\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Shortcut To Creating Properties in C-Sharp &#8211; Revisited\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#website\",\"url\":\"http:\/\/andrewpallant.ca\/wordpress\/\",\"name\":\"LDNDeveloper\",\"description\":\"Learning, Growing and Sharing.\",\"publisher\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/andrewpallant.ca\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\",\"name\":\"ldnDeveloper\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg\",\"contentUrl\":\"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg\",\"width\":512,\"height\":512,\"caption\":\"ldnDeveloper\"},\"logo\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\"},\"description\":\"Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http:\/\/www.unlatched.com\/#sthash.8DiTkpKy.dpuf\",\"sameAs\":[\"http:\/\/www.andrewpallant.ca\",\"https:\/\/x.com\/LdnDeveloper\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97\",\"name\":\"andrewpallant\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"andrewpallant\"},\"url\":\"http:\/\/andrewpallant.ca\/wordpress\/author\/andrewpallant\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Shortcut To Creating Properties in C-Sharp - Revisited - LDNDeveloper","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":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/","og_locale":"en_US","og_type":"article","og_title":"Shortcut To Creating Properties in C-Sharp - Revisited - LDNDeveloper","og_description":"Based on my earlier an post, a I had a question about my technique and if there was a benefit, or could you use MethodBase.GetCurrentMethod().Name. Truthfully I did not know the answer until I tried it. I found this new way works, but I also find it is a little tougher to look at style-wise. &hellip; Continue reading Shortcut To Creating Properties in C-Sharp &#8211; Revisited","og_url":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/","og_site_name":"LDNDeveloper","article_published_time":"2011-09-21T17:57:41+00:00","author":"andrewpallant","twitter_card":"summary_large_image","twitter_creator":"@ldnDeveloper","twitter_site":"@LdnDeveloper","twitter_misc":{"Written by":"andrewpallant","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#article","isPartOf":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/"},"author":{"name":"andrewpallant","@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97"},"headline":"Shortcut To Creating Properties in C-Sharp &#8211; Revisited","datePublished":"2011-09-21T17:57:41+00:00","dateModified":"2011-09-21T17:57:41+00:00","mainEntityOfPage":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/"},"wordCount":91,"commentCount":0,"publisher":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"articleSection":["C#","Deployment","Developer","DotNet","How To","Ideas"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/","url":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/","name":"Shortcut To Creating Properties in C-Sharp - Revisited - LDNDeveloper","isPartOf":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/#website"},"datePublished":"2011-09-21T17:57:41+00:00","dateModified":"2011-09-21T17:57:41+00:00","breadcrumb":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/andrewpallant.ca\/wordpress\/shortcut-to-creating-properties-in-c-sharp-revisited\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/andrewpallant.ca\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Shortcut To Creating Properties in C-Sharp &#8211; Revisited"}]},{"@type":"WebSite","@id":"http:\/\/andrewpallant.ca\/wordpress\/#website","url":"http:\/\/andrewpallant.ca\/wordpress\/","name":"LDNDeveloper","description":"Learning, Growing and Sharing.","publisher":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/andrewpallant.ca\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84","name":"ldnDeveloper","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg","contentUrl":"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg","width":512,"height":512,"caption":"ldnDeveloper"},"logo":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/"},"description":"Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http:\/\/www.unlatched.com\/#sthash.8DiTkpKy.dpuf","sameAs":["http:\/\/www.andrewpallant.ca","https:\/\/x.com\/LdnDeveloper"]},{"@type":"Person","@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97","name":"andrewpallant","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/","url":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"andrewpallant"},"url":"http:\/\/andrewpallant.ca\/wordpress\/author\/andrewpallant\/"}]}},"_links":{"self":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/277"}],"collection":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":0,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"wp:attachment":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}