You can, of course, enforce your bounds on any integer property in a class by checking them in the setter. However, this fails to clearly communicate the bounds requirements to users of that class. I tackled a similar problem in this question:
http://stackoverflow.com/questions/179295/how-do-i-indicate-a-validation-requirement-to-users-of-my-class
Based on that question and experience gained since, I propose you create a new BoundedInteger class. This class would have a value property, which should be self explanatory. It would also have implicit conversions to and from integer, to make it easy on users of your class. You would also add your MinValue and MaxValue items as readonly properties and and include them as required parameters in your class constructor.
One important addition is that you may not always want to throw an exception on bad assignments, because sometimes a bad assignment may not be all that exceptional. Depending on the context, there are several behaviors you can choose from when a bad assignment is attempted:
- Allow the assignment anyway (for example: someone might really want a value of 110%)
- Keep previous value
- Reset to zero or some other "default" value
- Set the value to the nearest bound (ie, if they try to assign 110 to a percentage, set it to 100 instead)
Any of those behaviors could also throw an exception or not, based on the needs of the property. Depending on your problem domain this may all be overkill, but it is worth keeping in mind as you design your program.
If you decide you do want this flexibility, you would want to define these behaviors in an enum, along with a read-only property to hold the value. Then, pick one for the default and then add an additional constructor where you can set a specific behavior for that instance along with whether an exception should be thrown. Finally, if you are going to potentially allow bad assignments you would want to provide an IsValid() method that tests against the bounds properties.