Partager via


VCCodeVariable Interface

An object representing a variable construct in a source file.

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

Syntax

<GuidAttribute("17730D52-271F-11D7-8BF6-00B0D03DAA06")> _
Public Interface VCCodeVariable

Dim instance As VCCodeVariable
[GuidAttribute("17730D52-271F-11D7-8BF6-00B0D03DAA06")]
public interface VCCodeVariable
[GuidAttribute(L"17730D52-271F-11D7-8BF6-00B0D03DAA06")]
public interface class VCCodeVariable
public interface VCCodeVariable

Remarks

The VCCodeVariable object is used to modify an existing variable construct.

Notes

A large part of the functionality of this object is provided by the Visual StudioCodeVariable object. For more information, see CodeVariable object.

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 retrieves all variables of the current solution and displays each name in a message box. It assumes a default MFC project is open.

Sub GetAllVars()
    Dim vcCM As VCCodeModel
    Dim vcVar As VCCodeVariable
    vcCM = DTE.Solution.Item(1).CodeModel
    For Each vcVar in vcCM.Variables
        MsgBox(vcVar.DisplayName)
    Next
End Sub

See Also

Reference

VCCodeVariable Members

Microsoft.VisualStudio.VCCodeModel Namespace