Share via


BuildDependencies.Item(Object) Method

Definition

Gets an indexed member of a BuildDependencies collection.

public:
 EnvDTE::BuildDependency ^ Item(System::Object ^ index);
public:
 EnvDTE::BuildDependency ^ Item(Platform::Object ^ index);
EnvDTE::BuildDependency Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.BuildDependency Item (object index);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.BuildDependency
Public Function Item (index As Object) As BuildDependency

Parameters

index
Object

Required. The index of the item to return.

Returns

A BuildDependency object.

Attributes

Examples

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

Remarks

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

Applies to