Partilhar via


ProjectItems.Item(Object) Method

Definition

Returns a ProjectItem object in a ProjectItems collection.

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

Parameters

index
Object

Required. The index of the ProjectItem object to return.

Returns

A ProjectItem object.

Attributes

Examples

' Before running, create a solution with an empty project named   
' "Project1".  
Sub ThrowArgumentException()  
    ' Projects of the current solution.  
    Dim cprojects As Projects = DTE.Solution.Projects     
    Dim project1 As Project = cprojects.Item(1)  
    Debug.Assert(cprojects.Item(project1.UniqueName) Is project1)  
End Sub  

Remarks

The value passed to Index is either an integer that is an index to a ProjectItem object in the ProjectItems collection or the UniqueName of a ProjectItem object in the collection.

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

Applies to