Item Method
Collapse the table of content
Expand the table of content

BuildDependencies.Item Method (Object)

 

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);
   }
}
Return to top
Show:
© 2016 Microsoft