July 2015
Intermediate to advanced
1300 pages
87h 27m
English
In Chapter 4, “Data Types and Expressions,” and in Chapter 14, “Generics and Nullable Types,” you learn a little about the new null-conditional operator. Visual Basic 2015 allows you to use this operator against collections, too. You can definitely use the ?. operator to check whether a collection is null before using it, but you can also take advantage of a special syntax that supports indexing. For example, the following code demonstrates how to retrieve the first item from a list of integers only if the collection is not null:
Function GetList() As List(Of Integer) Return New List(Of Integer) From {1, 2, 3}End FunctionSub NullCheckDemo() Dim x As List(Of Integer) ...