I read this from msdn about Int32.TryParse()
When this method returns, contains the 32-bit signed integer value equivalent to the num
The method returns a boolean indicating success or failure. Use that. The integer is a reference parameter passed into the method, and has nothing to do with the return value of the method.
Here's the prototype of Int32.TryParse() from the documentation. It's very clear that it returns a boolean. The second parameter is an out int which means that argument is passed by reference, so it will be mutated by the method.
public static bool TryParse(
string s,
out int result
)
So to check success or failure, do this:
int value;
if (Int32.TryParse("0", out value))
Console.WriteLine("Parsed as " + value);
else
Console.WriteLine("Could not parse");