Returns the specified code element of the parent object.
Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Syntax
声明
Function Item ( _
    index As Object _
) As CodeElement
CodeElement Item(
    Object index
)
CodeElement^ Item(
    Object^ index
)
abstract Item : 
        index:Object -> CodeElement 
function Item(
    index : Object
) : CodeElement
Parameters
- index
 Type: System.Object
 An object representing the location of an item in the collection.
Return Value
Type: EnvDTE.CodeElement
A CodeElement object.
Implements
Remarks
If the specified code element was not found, the method returns nulla null reference (Nothing in Visual Basic).
See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.
Examples
' Macro code.
' Displays the name of all the top level elements.
    Sub FindItem()
        Dim vcCM As VCCodeModel
        Dim vcCodeElements As VCCodeElements
        vcCM = DTE.Solution.Item(1).CodeModel
        vcCodeElements = vcCM.CodeElements
        Dim i As Integer
        For i = 1 To vcCodeElements.Count
            MsgBox(vcCodeElements.Item(i))
        Next
    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.