See here for the previous answer.
Ben Hoffstein
2010-06-03 03:00:08
Short answer is No. You may want to implement as below.
private int _length;
public int Length
{
get { return _length; }
set
{
if (value < 0)
{
throw new InvalidOperationException("Length must be always positive. Please make sure the value is positive value.");
}
this._length = value;
}
}