Export (0) Print
Expand All

BuildDependencies.Item Method

Gets an indexed member of a BuildDependencies collection.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

BuildDependency Item(
	Object index
)

Parameters

index
Type: System.Object

Required. The index of the item to return.

Return Value

Type: EnvDTE.BuildDependency
A BuildDependency object.

The Item method throws a ArgumentException exception if the collection cannot find the object that corresponds to the index value.

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);
   }
}

Show:
© 2014 Microsoft