public int ID
{
get { return _ID; }
}
public string Content
{
get { return _Content; }
}
public string Title
{
get { return _Title; }
}
public string From
{
get { return _From; }
}
public DateTime AddDate
{
get { return _AddDate; }
}
public int ClsID
{
get { return _clsID; }
}
public int TmpID
{
get { return _tmpID; }
}有时候还会出现什么get什么 set什么之类的形式 他们到底是什么 用来做什么用的 能给个例子看看最好了
比如说你有一个叫“人”的类
他有一些基本的属性吧?比如性别,年龄class Person{
private bool _sex;
private int _age;
public Person(bool sex,int age)
{
this._sex=sex;
this._age=age;
}
public bool Sex{get{return this._sex;}}//只读属性 true为男 false为女
public int Age{//可读写属性
get{
return this._age;
};
set{
this._age=value;
}
}
}//一个人的性别在出生后应该不会变吧??(除泰国人),但是他的年龄每年都会变的吧?
//现在使用这个Person类PerSon person=new Person(true,1);//初始化这么一个人 男人 1岁
person.Age=2;//过了一年后 你可以加一岁
//但是你不能 person.Sex=false; 你不能给他变性 应该他是只读的