BuildDependencies.Item 方法

取得 BuildDependencies 集合的索引成員。

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

語法

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

參數

  • index
    型別:System.Object
    必要項。所要傳回項目的索引。

傳回值

型別:EnvDTE.BuildDependency
BuildDependency 物件。

備註

如果集合無法找到對應於索引值的物件,Item 方法就會擲回 ArgumentException 例外狀況。

範例

public void Example(DTE2 dte)
{
   try
   {
      BuildDependencies bldDepends;
      BuildDependency bldDependency = null;

      // Get the BuildDependencies in open solution.
      bldDepends = dte.Solution.SolutionBuild.BuildDependencies;
      if (bldDepends.Count > 0) // assign the BuildDependency
         bldDependency = bldDepends.Item(bldDepends.Count);
      // Show the BuildDependency returned by the Item property.
      MessageBox.Show(bldDependency.Project.Name);
      // Show the BuildDependencies top-level object.
      MessageBox.Show(bldDepends.DTE.Name);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

.NET Framework 安全性

請參閱

參考

BuildDependencies 介面

EnvDTE 命名空間

其他資源

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