get,set总结
来源:互联网 发布:天津网络研究所地址 编辑:程序博客网 时间:2024/04/28 17:19
属性的定义和使用
属性由两个部分组成:属性头和存储器。存储器分为get访问器和set访问器。声明属性的一般形式为:
修饰符 学校名称不可修改
private string stuName = "<span courier="" new";="" mso-hansi-font-family:"courier="" new";mso-bidi-font-family:"courier="" color:maroon;mso-font-kerning:0pt;"="" style="line-height: 21px; font-size: 9pt; font-family: 宋体; ">阿会楠";
private int stuAge = 22;
public string studentName
{
get { return stuName; }
set { stuName = value; }
}
public int studentAge
{
get { return stuAge; }
set { stuAge = value; }
}
public string studentCollege
{
get { return stuCollege; }
}
public string studentInfo
{
get { return "<span courier="" new";="" mso-hansi-font-family:"courier="" new";mso-bidi-font-family:"courier="" color:maroon;mso-font-kerning:0pt;"="" style="line-height: 21px; font-size: 9pt; font-family: 宋体; ">学校:" + stuCollege + "<span courier="" new";="" mso-hansi-font-family:"courier="" new";mso-bidi-font-family:"courier="" color:maroon;mso-font-kerning:0pt;"="" style="line-height: 21px; font-size: 9pt; font-family: 宋体; ">名字:" + stuName + "<span courier="" new";="" mso-hansi-font-family:"courier="" new";mso-bidi-font-family:"courier="" color:maroon;mso-font-kerning:0pt;"="" style="line-height: 21px; font-size: 9pt; font-family: 宋体; ">岁数:" + stuAge;}
}
}
class Program
{
static void Main(string[] args)
{
Student stu = new Student();
Console.Write(stu.studentCollege + "\n");
stu.studentAge = 25;
Console.Write(stu.studentInfo);
Console.ReadKey();
}
}
}
- get,set总结
- ASP.NET中get set用法总结
- get set
- get set
- Get&Set
- set ; get
- get set
- get&set
- get set
- set() get()
- set() get()
- objective-c自学总结(二)---init/set/get方法
- [Java] 关于set()和get()方法的一点总结
- 关于继承里面子类get/set方法的小总结
- SystemProperties.get/set property_get/set
- get与set
- Set&Get and MACRO
- .net get set用法
- 判断SQL数据库中函数、存储过程等是否存在的方法
- sql 存储过程命名规范
- 我仿佛又看到了岳父亲坐在办公桌前孜孜不倦读书的情景
- C#中反射的应用小结
- .Net (C#)Get和Set的基本用法
- get,set总结
- DOS命令
- SQL日期转换CONVERT函数
- 夏天不好
- GridView中的DataFormatString属性
- SQL语句增删改表的字段
- 后台设置tr属性可见
- SQL 中With as 的用法
- 清除vs2003-vs2008起始页最近打开项目