Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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("DF69B05E-2447-11D7-8BF6-00B0D03DAA06")] 
public interface VCCodeElements : CodeElements
/** @attribute GuidAttribute("DF69B05E-2447-11D7-8BF6-00B0D03DAA06") */ 
public interface VCCodeElements extends CodeElements
GuidAttribute("DF69B05E-2447-11D7-8BF6-00B0D03DAA06") 
public interface VCCodeElements extends CodeElements

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 Samples for 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
Show:
© 2015 Microsoft