我在代码中不断收到错误或异常。
问题描述:
public string PhoneType
{
get{return _phoneType;}
set
{
if(value == "Home" || value == "Mobile" || value == "Work")
{
_phoneType = value;
}
else
{
throw new ArgumentOutOfRangeException("invalid values or PhoneType:");
}
}
}
答
你好
像这样使用
Hello
use like this
public int myProp
{
get { if (condition) { return a; } else { return b;} }
set
{
a = value;
}
}
谢谢
Abhimanyu Rawat
Thanks
Abhimanyu Rawat