码迷,mamicode.com
首页 > 其他好文 > 详细

get set

时间:2016-07-24 19:24:27      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

class Program
    { 
  
        static void Main(string[] args)
        {
            MyClass MyObject = new MyClass();
            Console.Write(MyObject.Integer);
            MyObject.Integer++;
            Console.Write(MyObject.Integer);

        }
   
    }

    class MyClass
    {
        int integer;
        public int Integer
        {
            get { return integer; }
            set { integer = valeue; } //integer = 55;
        }
    }  

输出的结果是:01

如果使用备注的。输出结果是055

get set

标签:

原文地址:http://www.cnblogs.com/lizhenlin/p/5701373.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!