We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

CodeVariable Interface

An object defining a variable construct in a source file.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

<GuidAttribute("0CFBC2BA-0D4E-11D3-8997-00C04F688DDE")> _
Public Interface CodeVariable

The CodeVariable type exposes the following members.

Public propertyAccessDefines the access modifier of this item.
Public propertyAttributesGets a collection of all of the attributes for the parent object.
Public propertyChildrenGets a collection of objects contained within this CodeVariable.
Public propertyCollectionGets the collection containing the CodeVariable object supporting this property.
Public propertyCommentGets or sets the comment associated with the code element.
Public propertyDocCommentGets or sets the document comment for the current code model element.
Public propertyDTEGets the top-level extensibility object.
Public propertyEndPointGets the edit point that is the location of the end of the code item.
Public propertyExtenderReturns the requested Extender object if it is available.
Public propertyExtenderCATIDGets the Extender category ID (CATID) for the object.
Public propertyExtenderNamesGets a list of available Extenders for the object.
Public propertyFullNameGets the full path and name of the CodeVariable object's file.
Public propertyInfoLocationGets the capabilities of the code model object.
Public propertyInitExpressionSets or gets an object defining the initialization code for an element.
Public propertyIsCodeTypeGets whether a CodeType object can be obtained from this object.
Public propertyIsConstantGets or sets whether or not the item is a constant.
Public propertyIsSharedSets or gets whether or not the item is statically defined, that is, whether the item is common to all instances of this object type or only to this object specifically.
Public propertyKindGets an enumeration indicating the type of object.
Public propertyLanguageGets the programming language used to author the code.
Public propertyNameSets or gets the name of the object.
Public propertyParentGets the immediate parent object of a CodeVariable object.
Public propertyProjectItemGets the ProjectItem object associated with the CodeVariable object.
Public propertyPrototypeReturns a string holding the stub definition of this object.
Public propertyStartPointGets a TextPoint object that defines the beginning of the code item.
Public propertyTypeSets or gets an object representing the programmatic type.

Public methodAddAttributeCreates a new attribute code construct and inserts the code in the correct location.
Public methodGetEndPointReturns a TextPoint object that marks the end of the code element definition.
Public methodGetStartPointReturns a TextPoint object that defines the beginning of the code element definition.


The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).