我收到一个错误,例如
“在 ciscontrols.dll 中发生了‘System.StackOverflowException’类型的未处理异常”。
我的代码如下
private int _vin;
public int MaxLength
{
get { return _vin; }
set //Here your answer solve the promblem
{
txtLocl.MaxLength = value;
if (value < 2)
{
throw new ArgumentOutOfRangeException("MaxLength","MaxLength MinValue should be 2.");
}
else this._vin = value;
}
}
我正在为小数位创建一个新属性
private int Dval;
public int DecPlaces
{
get { return Dval; }
set// here it showing the same error
{
DecPlaces = value; // MaxLength is a preDefined Property but DecPlaces created by me.
if (value < 2)
{
throw new ArgumentOutOfRangeException("decplaces", "decimal places minimum value should be 2.");
}
else this.Dval = value;
}
}