Option Infer Directive

To enable or disable local type inference, the Visual Basic grammar provides the Option Infer directive. Option Infer On enables inference whereas Option Infer Off disables it. Generally you do not need to explicitly provide an Option Infer directive because it is offered at the project level by Visual Studio. By default, Option Infer is On. If you want to change default settings for the current project, simply open My Project and then switch to the Compile tab. There you can find the Visual Basic compiler options including Option Infer. If you instead want to change settings for each new project, simply choose the Options command from the Tools menu. When the Options dialog appears, move to the Projects and Solutions

Get Visual Basic® 2010 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.