We instantiate “number”, pass it to TryParse and it will be populated with 1234 if the parse succeeds.

C# 7 saves us from the necessity of declaring a variable up front in the following way:

public void NewWay()
{
//include out param in expression
if (int.TryParse("1234", out int number)) //works with "var" as well as with the concrete object type
{
Console.WriteLine(number);
}
Console.WriteLine(number);
}

So we declare “number” in an expression and it will be available outside the “if” block as well.

If parsing fails then the declared variable will get a default value. Numbers get 0, reference types “null” etc.