private int index
{
get
{
object o = ViewState["index "];
return (o == null) ? 600 : (int)o;
}
set
{
ViewState["index "] = value;
}
}求解释
{
get
{
object o = ViewState["index "];
return (o == null) ? 600 : (int)o;
}
set
{
ViewState["index "] = value;
}
}求解释
ViewState 获取状态信息的字典
(o == null) ? 600 : (int)o;如果o是null则去600,否则去(int)o就是取值赋值
但是意思是通过这属性取出ViewState对应的值
当属性值为null时 默认 600;
set是赋值
这次明白属性的做用了吧
虽然是private的
但却可以在属性里进行逻辑判断
ViewState 是一个内嵌对象.类似字典