Sdílet prostřednictvím


VCCodeElements Interface

Definition

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

public interface class VCCodeElements : EnvDTE::CodeElements
public interface class VCCodeElements : EnvDTE::CodeElements
__interface VCCodeElements : EnvDTE::CodeElements
[System.Runtime.InteropServices.Guid("8AB55688-C21C-4E71-8FB8-4C4C4534E755")]
[System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FDispatchable | System.Runtime.InteropServices.TypeLibTypeFlags.FDual)]
public interface VCCodeElements : EnvDTE.CodeElements
[<System.Runtime.InteropServices.Guid("8AB55688-C21C-4E71-8FB8-4C4C4534E755")>]
[<System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FDispatchable | System.Runtime.InteropServices.TypeLibTypeFlags.FDual)>]
type VCCodeElements = interface
    interface CodeElements
Public Interface VCCodeElements
Implements CodeElements
Attributes
Implements

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  

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.

Properties

Count

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

DTE

Gets the top-level extensibility object.

Parent

Gets the immediate parent object of a given object.

Methods

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#.

Find(String)

Returns the specified code element of the parent object.

GetEnumerator()

Gets an enumerator for items in the VCCodeElements collection.

Item(Object)

Returns the specified code element of the parent object.

Reserved1(Object)

Microsoft Internal Use Only.

Sort(vsCMSort)

Sorts a collection of elements.

Applies to