/optioninfer

Enables the use of local type inference in variable declarations.

/optioninfer[+ | -]

Arguments

Term

Definition

+ | -

Optional. Specify /optioninfer+ to enable local type inference, or /optioninfer- to block it. The /optioninfer option, with no value specified, is the same as /optioninfer+. The default value when the /optioninfer switch is not present is also /optioninfer+. The default value is set in the Vbc.rsp response file.

Note

You can use the /noconfig option to retain the compiler's internal defaults instead of those specified in vbc.rsp. The compiler default for this option is /optioninfer-.

Remarks

If the source code file contains an Option Infer Statement, the statement overrides the /optioninfer command-line compiler setting.

To set /optioninfer in the Visual Studio IDE

  1. Select a project in Solution Explorer. On the Project menu, click Properties. For more information, see Managing Project Properties with the Project Designer.

  2. On the Compile tab, modify the value in the Option infer box.

Example

The following code compiles test.vb with local type inference enabled.

vbc /optioninfer+ test.vb

See Also

Reference

/optioncompare

/optionexplicit

/optionstrict

Sample Compilation Command Lines (Visual Basic)

Option Infer Statement

Visual Basic Defaults, Projects, Options Dialog Box

Compile Page, Project Designer (Visual Basic)

/noconfig

Concepts

Local Type Inference (Visual Basic)

Other Resources

Visual Basic Command-Line Compiler

Building from the Command Line (Visual Basic)