ProjectItems::Item Method (Object^)

 

Returns a ProjectItem object in a ProjectItems collection.

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

ProjectItem^ Item(
	Object^ index
)

Parameters

index
Type: System::Object^

Required. The index of the ProjectItem object to return.

Return Value

Type: EnvDTE::ProjectItem^

A ProjectItem object.

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.

' 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
Return to top
Show: