{"id":1216,"date":"2020-04-16T13:25:42","date_gmt":"2020-04-16T01:25:42","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1216"},"modified":"2020-04-16T13:26:11","modified_gmt":"2020-04-16T01:26:11","slug":"class-property","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1216","title":{"rendered":"Class Property"},"content":{"rendered":"<h1>Description<\/h1>\n<p>A member of a class that provides flexibility for exposing private fields.<\/p>\n<h1>Sample Property Declaration<\/h1>\n<pre>\/\/backing private field\r\nprivate string prop;\r\n\r\npublic string ReadWriteProp {\r\n    get {\r\n        return prop;\r\n    }\r\n    set {\r\n        prop = value;\r\n    }\r\n}\r\n\r\npublic string ReadOnlyProp {\r\n    get {\r\n        return prop;\r\n    }\r\n}\r\n\r\npublic string WriteOnlyProp {\r\n    set {\r\n        prop = value;\r\n    }\r\n}<\/pre>\n<h1>Sample Auto-Implemented Property Declaration<\/h1>\n<p>A more concise property declaration especially if theres no additional logic required for the accessors.<\/p>\n<pre>public string ReadWriteProp {\r\n    get; set;\r\n} \r\n\r\npublic string ReadOnlyProp {\r\n    get; private set;\r\n} \r\n\r\npublic string WriteOnlyProp {\r\n    private get; set;\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Description A member of a class that provides flexibility for exposing private fields. Sample Property Declaration \/\/backing private field private string prop; public string ReadWriteProp { get { return prop; } set { prop = value; } } public string ReadOnlyProp { get { return prop; } } public string WriteOnlyProp { set { prop [&hellip;]<\/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\/1216"}],"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=1216"}],"version-history":[{"count":2,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1216\/revisions"}],"predecessor-version":[{"id":1218,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1216\/revisions\/1218"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}