/optioninfer
更新:2007 年 11 月
在變數宣告中啟用區域型別推斷。
/optioninfer[+ | -]
引數
- + | -
選擇項,指定 /optioninfer+ 可啟用區域型別推斷,指定 /optioninfer- 則可加以封鎖。未指定值的 /optioninfer 選項,與 /optioninfer+ 相同。沒有 /optioninfer 參數時的預設值也是 /optioninfer+。預設值設定在 Vbc.rsp 回應檔 (Response File) 中。
![]() |
---|
您可以使用 /noconfig 選項保留編譯器的內部預設值,而非 vbc.rsp 中指定的值。此選項的編譯器預設值為 /optioninfer-。 |
備註
若要在 Visual Studio 整合式開發環境中設定 /optioninfer
在 [方案總管] 中選取專案。
按一下 [專案] 功能表上選取之專案的 [屬性] 連結,存取 [專案設計工具]。如需詳細資訊,請參閱專案設計工具簡介。
在 [編譯] 索引標籤上,修改 [Option Infer] 方塊中的值。
若要以程式設計方式設定 /optioninfer
- 請參閱 Option Infer 陳述式。
範例
下列程式碼會編譯 test.vb,並啟用區域型別推斷。
vbc /optioninfer+ test.vb