You can't do this without using another variable, unfortunately - because the type of out
arguments has to match the parameter exactly.
Like Daniel's code, but fixed in terms of the second argument, trimming, and avoiding comparisons with Boolean constants:
int tmp;
if (!int.TryParse(strValue.Trim(), out tmp))
{
break;
}
intVal = tmp;