Local Type Inference Scope
The word local in the local type inference definition has a special meaning. Local type inference works only with local variables defined within code blocks and does not work with class-level declarations. For example, consider the following code:
Class Person Property LastName As String Property FirstName As String Function FullName() As String 'Local variable: local type inference works Dim completeName = Me.LastName & " " & Me.FirstName Return completeName End FunctionEnd Class
Local type inference affects the completeName
local variable, which is enclosed within a method. Now consider the following code:
'Both Option Strict ...
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.