Share via


BuildDependencies.Item Method

Gets an indexed member of a BuildDependencies collection.

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

Syntax

'Declaration
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

Parameters

  • index
    Type: System.Object

    Required. The index of the item to return.

Return Value

Type: EnvDTE.BuildDependency
A BuildDependency object.

Remarks

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

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

.NET Framework Security

See Also

Reference

BuildDependencies Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples