ProjectItems.Item Method
Returns a ProjectItem object in a ProjectItems collection.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
Function Item ( _
index As Object _
) As ProjectItem
ProjectItem Item(
Object index
)
ProjectItem^ Item(
[InAttribute] Object^ index
)
abstract Item :
index:Object -> ProjectItem
function Item(
index : Object
) : ProjectItem
Parameters
index
Type: System.ObjectRequired. The index of the ProjectItem object to return.
Return Value
Type: EnvDTE.ProjectItem
A ProjectItem object.
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.
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
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Other Resources
How to: Compile and Run the Automation Object Model Code Examples