BuildDependencies.Item メソッド

更新 : 2007 年 11 月

BuildDependencies コレクションのインデックス付きメンバを取得します。

名前空間 :  EnvDTE
アセンブリ :  EnvDTE (EnvDTE.dll 内)

構文

'宣言
Function Item ( _
    index As Object _
) As BuildDependency
'使用
Dim instance As BuildDependencies
Dim index As Object
Dim returnValue As BuildDependency

returnValue = instance(index)
BuildDependency Item(
    Object index
)
BuildDependency^ Item(
    [InAttribute] Object^ index
)
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);
   }
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

BuildDependencies インターフェイス

BuildDependencies メンバ

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する