共用方式為


Configurations.Item 方法

傳回在 Configurations 集合中的 Configuration 物件。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
Function Item ( _
    index As Object _
) As Configuration
Configuration Item(
    Object index
)
Configuration^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Configuration
function Item(
    index : Object
) : Configuration

參數

  • index
    類型:Object

    必要項。 所要傳回之 Configuration 物件的索引。

傳回值

類型:EnvDTE.Configuration
Configuration 物件。

備註

傳遞到 index 的值,可為代表在 Configurations 集合中之 Configuration 物件的整數值,或是集合中 Configuration 物件的名稱。

範例

public void CodeExample(DTE2 dte, AddIn addin)
{   
    try
    {   // Make sure you have a solution loaded into Visual Studio
        // before running the following example. Make sure the "Any CPU" 
        // option is marked in the Configuration Manager dialog box.
        Configurations configs = null;
        if (dte.Solution.Projects.Count > 0)
        {
            configs = dte.Solution.Projects.Item(1).ConfigurationManager.Platform("Any CPU");
            // Show the configuration name of the first item in 
            // the Configurations collection.
            MessageBox.Show(configs.Item(1).ConfigurationName);
        }
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 安全性

請參閱

參考

Configurations 介面

EnvDTE 命名空間

其他資源

如何:編譯和執行 Automation 物件模型程式碼範例