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)

[GuidAttribute("C49A2E65-13F1-46A2-A008-1E01DCAF19E1")]
public interface VCCodeElements : CodeElements

NameDescription
System_CAPS_pubpropertyCount

Gets a value indicating the number of objects in the collection.

System_CAPS_pubpropertyDTE

Gets the top-level extensibility object.

System_CAPS_pubpropertyParent

Gets the immediate parent object of a given object.

NameDescription
System_CAPS_pubmethodCreateUniqueID(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#.

System_CAPS_pubmethodFind(String)

Returns the specified code element of the parent object.

System_CAPS_pubmethodGetEnumerator()

Gets an enumerator for items in the VCCodeElements collection.

System_CAPS_pubmethodItem(Object)

Returns the specified code element of the parent object.

System_CAPS_pubmethodReserved1(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.

System_CAPS_pubmethodSort(vsCMSort)

Sorts a collection of elements.

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.

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