标签:
属性与字段的使用类似iOS
class Class1 { //字段私有,属性公有 private string _name; private int _age; public string Name { set { _name = value; } get { return _name; } } public int Age { set { _age = value; } get { return _age; } } public void Function() { Console.WriteLine("姓名{0},年龄{1}",this.Name,this.Age); } }
标签:
原文地址:http://www.cnblogs.com/liuguan/p/5918376.html