If you're trying to do comparisons based on the result of the call to TryParse
then therein lies your problem; that returns a boolean to indicate success or not (hence the Try). So you need to compare the inOutValue
as that's what has been populated.
public static bool GetInteger(string input, out int result, int min, int max) {
return int.TryParse(input, out result) && (result >= min && result <= max);
}
There is no need for an out
param here, and I'd even say the method naming is bad, unless you actually want the value to be accessible after the fact.