Share via


VCCodeElements.Item(Object) Method

Definition

Returns the specified code element of the parent object.

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

Parameters

index
Object

An object representing the location of an item in the collection.

Returns

A CodeElement object.

Implements

Attributes

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  

Remarks

If the specified code element was not found, the method returns null.

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

Applies to