日期:2014-05-18 浏览次数:20894 次
class class1 { public string Name { get; set; } public string Address { get; set; } public string this[string propertyname] { //当然更好的写法是反射 get { if (propertyname == "name") return Name; if (propertyname == "address") return Address; return ""; } set { if (propertyname == "name") Name = value; if (propertyname == "address") Address = value; } } }