Keep an integer within bounds? : <p>To keep an integer within certain bounds, currently I'm doing:</p>

<pre><code>frame.X = frame.X &lt;= 0 ? 0 : frame.X;
frame.X = frame.X + frame.Width &gt; Image.Width ? Image.Width - frame.Width : frame.X;

frame.Y = frame.Y &lt;= 0 ? 0 : frame.Y;
frame.Y = frame.Y + frame.Height &gt; Image.Height ? Image.Height - frame.Height : frame.Y;
</code></pre>

<p>Is there a cleaner way for bound checking?</p>
