VCCodeElements Interface

A collection of objects (representing individual code elements) within one or more source files.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

'Declaration
<GuidAttribute("88D67CB2-EF57-4E3D-82FA-0C8C03ACEF54")> _
Public Interface VCCodeElements _
    Inherits CodeElements
[GuidAttribute("88D67CB2-EF57-4E3D-82FA-0C8C03ACEF54")]
public interface VCCodeElements : CodeElements
[GuidAttribute(L"88D67CB2-EF57-4E3D-82FA-0C8C03ACEF54")]
public interface class VCCodeElements : CodeElements
[<GuidAttribute("88D67CB2-EF57-4E3D-82FA-0C8C03ACEF54")>]
type VCCodeElements =  
    interface
        interface CodeElements
    end
public interface VCCodeElements extends CodeElements

The VCCodeElements type exposes the following members.

Properties

  Name Description
Public property Count (Inherited from CodeElements.)
Public property Count Gets a value indicating the number of objects in the collection.
Public property DTE (Inherited from CodeElements.)
Public property DTE Gets the top-level extensibility object.
Public property Parent (Inherited from CodeElements.)
Public property Parent Gets the immediate parent object of a given object.

Top

Methods

  Name Description
Public method CreateUniqueID(String, String%) (Inherited from CodeElements.)
Public method CreateUniqueID(String, String%) Creates a programmatic identifier that does not collide with other identifiers in the scope, and follows the current language naming rules. This method is not implemented in Visual C#.
Public method Find Returns the specified code element of the parent object.
Public method GetEnumerator() (Inherited from CodeElements.)
Public method GetEnumerator() Gets an enumerator for items in the VCCodeElements collection.
Public method Item(Object) (Inherited from CodeElements.)
Public method Item(Object) Returns the specified code element of the parent object.
Public method Reserved1(Object) (Inherited from CodeElements.)
Public method Reserved1(Object) Infrastructure. Microsoft Internal Use Only.
Public method Sort Sorts a collection of elements.

Top

Remarks

A VCCodeElements collection object is a collection of one or more VCCodeElement objects. Each object in the VCCodeElements collection object represents an individual code element (such as a definition or element of declarative syntax).

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

Examples

This example displays the names of all code element objects declared at the global namespace level of the existing project (alphabetically).

' Macro code.
Sub GetGlobalElements()
    Dim vcCM As VCCodeModel
    Dim vcElement As VCCodeElement
    Dim vcElements as VCCodeElements
    vcCM = DTE.Solution.Item(1).CodeModel
    vcElements = vcCM.CodeElements
    vcElements.Sort(vsCMSort.vsCMSortAlpha)
    For Each vcElement In vcElements
        MsgBox(vcElement.DisplayName)
    Next
End Sub

See Also

Reference

Microsoft.VisualStudio.VCCodeModel Namespace