BuildDependencies.Item(Object) Метод

Определение

Возвращает индексированный член коллекции BuildDependencies.

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

Параметры

index
Object

Обязательный. Индекс возвращаемого элемента.

Возвращаемое значение

BuildDependency

Объект BuildDependency.

Атрибуты

Примеры

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

Комментарии

ItemМетод создает исключение, ArgumentException Если коллекция не может найти объект, соответствующий значению индекса.

Применяется к