試用:
bool IsVerifyingPassword
{
get
{
bool returnValue = false;
object viewStateValue = ViewState["IsDoubleCheckPassword"];
if (viewStateValue != null)
{
// stay false if not able to retrieve bool from ViewState
bool.TryParse(viewStateValue.ToString(), out returnValue);
}
return returnValue;
}
如果房產真的應該爲空的布爾則:
bool? IsVerifyingPassword
{
get
{
object viewStateValue = ViewState["IsDoubleCheckPassword"];
if (viewStateValue != null)
{
bool returnValue = false;
// stay false if not able to retrieve bool from ViewState
bool.TryParse(viewStateValue.ToString(), out returnValue);
return returnValue;
}else
{
return null;
}
}
來源
2011-08-14 10:28:42
sll
是指從吸氣或設置方法拋出? –
@FredrikMörk:Getter –
沒有堆棧跟蹤? –