Signaling that the values of a variable have been rejected
<p>In C# I'm writing a class that checks the values of its properties with a setter method:</p>

<pre><code>private int _grade
public int Grade {
    get { return _grade;}
    set { if (value &gt;= this.lowerLimit) _grade = value; }
}
</code></pre>

<p>I would like to signal to the application if a value was rejected. I had considered refactoring to use a setGrade function that returns a bool (accepted / rejected) but the ability to do someInstance.Grade++ and someInstance.Grade*=2 are important. Simple functions incrementGrade and divideGrade will make the code a mess, and there will certainly be some function that I forgot to implement (too much coupling).</p>

<p>My current solution is to check the value of someInstance.Grade after setting it, to ensure that it has been set. But it seems to me that this is just moving the mess from the class to the application. Indeed, it is the responsibility of the application to ensure that the value was properly set.</p>

<p>How do those more experienced handle this? Thanks!</p>
