Determine if an int is within range Can I somehow make this a bit cleaner using Math.[Something], without making a method for it?

int MaxSpeed = 50;

if (Speed.X &gt; MaxSpeed)
    Speed.X = MaxSpeed;

if (Speed.X &lt; MaxSpeed * -1)
    Speed.X = MaxSpeed * -1;

if (Speed.Y &gt; MaxSpeed)
    Speed.Y = MaxSpeed;

if (Speed.Y &lt; MaxSpeed * -1)
    Speed.Y = MaxSpeed * -1;
There's a method in XNA called MathHelper.Clamp that does what you need. I understand if you don't want to import XNA libraries for this one function, though. You can do this with extension methods. Here's an implementation that uses generics (so you can apply it to various types) so you can use it for ints, longs, anything that implements IComparable

static class Extensions
{
    public static T Clamp&lt;T&gt; (this T self, T min, T max) where T: IComparable
    {
        if (self.CompareTo( min) &lt;0)
            return min;
        return self.CompareTo(max) &gt; 0 ? max : self;
    }
}