Skip to Content
Visual Basic 2015 Unleashed
book

Visual Basic 2015 Unleashed

by Alessandro Del Sole
July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Sams
Content preview from Visual Basic 2015 Unleashed

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Visual Basic 2015

Beginning Visual Basic 2015

Bryan Newsome

Publisher Resources

ISBN: 9780134196664Purchase book