I have a project that uses .Net 4.0. (the target framework is .Net 4).
I use Visual Studio 2017 to compile the source, and used the following code:
if(int.TryParse(inputText, out int x))
StartAnotherMethod(x);
It successfuly compiled on my computer so I commited it to the repository and waited for the build server to compile as well.
Surprisingly, it had compilation errors.
error CS1525: Invalid expression term 'int'
error CS1003: Syntax error, ',' expected
I checked it in an online compiler. It uses .Net 4.5, and also shows compilation errors.
https://dotnetfiddle.net/pibxC2
Compilation error (line 9, col 32): Invalid expression term 'int'
Compilation error (line 9, col 33): ; expected
Compilation error (line 9, col 33): Invalid expression term ')'
Compilation error (line 9, col 34): ; expected
Compilation error (line 9, col 34): Invalid expression term ')'
Compilation error (line 9, col 35): ; expected
As I have read, language features don't require new frameworks, so it should compile without any problem.
What did I miss?