Does anybody know what does the following construct mean:
Dim s1 as [String]
What do the square brackets mean? And why does the following statement with Integer fail while the one above, with String works?
Dim i1 as [Integer]
Thanks in advance.
THe square brackets is used so that the compiler interprets it as a type, even if it would be a keyword. Imagine for example if you had a class named
As:This is usually only used in auto generated code, so that it works with any type that you throw at it.
The reason that you can’t use
[Integer]is thatIntegeris not a data type, it’s a keyword. You would have to use the corresponding data type, i.e.[Int32].