我知道C#3.0有一个自动实现属性的新特性,我喜欢它,因为我们不需要在这个属性中声明额外的私有变量(与之前的属性相比),之前我使用了一个属性,即.
private bool isPopup = true;
public bool IsPopup
{
get
{
return isPopup;
}
set
{
isPopup = value;
}
}
现在我已经将其转换为自动实现的属性,即
public bool IsPopup
{
get; set;
}
我想将这个属性的默认值设置为true而不使用它,即使在page_init方法中也不使用,我try 了但没有成功,有谁能解释一下如何做到这一点吗?