Array Literals
The array literals feature works like the local type inference but is specific to arrays. It was first introduced in Visual Basic 2010. Consider this array of strings declaration as you would write it in Visual Basic 2008:
Dim anArrayOfStrings() As String = {"One", "Two", "Three"}
In Visual Basic 2015 you can write it as follows:
'The compiler infers String()Dim anArrayOfStrings = {"One", "Two", "Three"}
According to the preceding code, you are still required to place only a couple of parentheses, but you can omit the type that is correctly inferred by the compiler as you can easily verify by passing the mouse pointer over the variable declaration. Of course, array literals ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.