{"id":945,"date":"2013-10-21T19:43:31","date_gmt":"2013-10-21T11:43:31","guid":{"rendered":"http:\/\/blog.dayandcarrot.net\/?p=816"},"modified":"2013-10-21T19:43:31","modified_gmt":"2013-10-21T11:43:31","slug":"c%e7%9a%84get%e5%92%8cset","status":"publish","type":"post","link":"https:\/\/dayandcarrot.space\/?p=945","title":{"rendered":"C#\u7684get\u548cset"},"content":{"rendered":"<p>\u521d\u5b66\u521d\u5b66C#\uff0c\u53d1\u73b0\u8ddfJava\u6ca1\u5565\u533a\u522b:)<br \/>\n<code lang=\"C#\"><br \/>\n\/\/Class<br \/>\npublic class TestClass<br \/>\n{<br \/>\n    private double _numberA = 0;<br \/>\n    public double NubmerA<br \/>\n    {<br \/>\n        get { return _numberA;}<br \/>\n        set { _numberA = value;}<br \/>\n    }<br \/>\n}<br \/>\n\/\/Main<br \/>\npublic class MainClass<br \/>\n{<br \/>\n   public static void Main()<br \/>\n   {<br \/>\n     TestClass t = new TestClass();<br \/>\n     r.NumberA = 123.456; \/\/ Derived class property<br \/>\n     Console.WriteLine(\"Number in the derived class is \" + d1.NumberA);<br \/>\n  }<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u5b66\u521d\u5b66C#\uff0c\u53d1\u73b0\u8ddfJava\u6ca1\u5565\u533a\u522b:) \/\/Class public class TestClass { private double _numberA = 0; public double NubmerA { get { return _numberA;} set { _numberA = value;} } } \/\/Main public class MainClass { public static void Main() { TestClass t = new TestClass(); r.NumberA = 123.456; \/\/ Derived class property Console.WriteLine(&#8220;Number in the derived class is &#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[28],"class_list":["post-945","post","type-post","status-publish","format-standard","hentry","category-study","tag-c"],"_links":{"self":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=945"}],"version-history":[{"count":0,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/945\/revisions"}],"wp:attachment":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}