In the process of upgrading vb.net code from Visual Studio 2008 to Visual Studio 2015, I am getting an 'Integer' is not declared. It may be inaccessible due to its protection level. error on the following code:
[Integer].TryParse(...)
The error also occurs on similar code with [Date].TryParse. The target framework for both the original and upgraded code is .NET Framework 3.5. Upgrading the target framework doesn't matter. If I remove the square brackets, the code compiles. Does anyone know why this syntax works in Visual Studio 2008 but not Visual Studio 2015?
As @Plutonix @Blorgbeard and @jmcilhinney all answered in comments, you need to remove the square brackets. Converted to community wiki in line with this meta post recommendation, to remove from 'Unanswered' section.
@ jmcilhinney
The whole point of brackets is to indicate to the compiler that you want to use a keyword as an identifier. In this case, you're calling a Shared member of a type so you specifically DO want Integer or Date to be interpreted as a keyword, i.e. their intrinsic types. You'll sometimes see that done with String but that works because String is a .NET type. Integer and Date are not .NET types. The .NET types that correspond to those intrinsic types are Int32 and DateTime