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

VCCodeFunction Interface

An object defining a function construct in a source file.

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

public interface VCCodeFunction

The VCCodeFunction type exposes the following members.

Public propertyAccessGets or sets the access attributes of this item.
Public propertyAttributesGets a collection of all of the attributes for the parent object.
Public propertyBodyTextGets or sets the body text of the parent object.
Public propertyCanOverrideGets or sets a value indicating whether or not the function can be overridden.
Public propertyChildrenGets a collection of objects contained within this code construct.
Public propertyCodeModelGets the VCCodeModel object for the project.
Public propertyCollectionGets the collection containing the object supporting this property or contained within this code construct.
Public propertyCommentGets or sets the comment associated with the code element.
Public propertyDeclarationTextGets or sets the declaration of the object.
Public propertyDisplayNameGets the name used in the user interface for this output group.
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 propertyEndPointOfGets the end point of the parent object.
Public propertyExtenderGets the requested Extender object if it is available for this object.
Public propertyExtenderCATIDGets the Extender category ID (CATID) for the object.
Public propertyExtenderNamesGets a list of available Extenders for the object.
Public propertyFileGets the file where this object is defined.
Public propertyFullNameGets the full path and name of the object's file.
Public propertyFunctionKindGets an enumeration describing how a function is used.
Public propertyInfoLocationGets the capabilities of the code model.
Public propertyIsCaseSensitiveGets a value indicating whether a code element is case-sensitive.
Public propertyIsCodeTypeGets a value indicating whether a CodeType object can be obtained from this object.
Public propertyIsConstantGets or sets a value indicating whether or not the item is a constant.
Public propertyIsInjectedGets a value indicating if a code element has been injected by an attribute or macro expansion.
Public propertyIsInlineGets or sets the inline property of the function object.
Public propertyIsOverloadedGets a value indicating whether or not a function is overloaded.
Public propertyIsReadOnlyGets a value indicating whether the file containing the parent object is read-only.
Public propertyIsSealedSets or gets the IsSealed keyword on a function.
Public propertyIsSharedGets or sets a value indicating whether or not the item is statically defined, that is, if the item is common to all instances of this object type, or only to this object specifically.
Public propertyIsTemplateGets a value indicating whether the parent object is a template.
Public propertyIsVirtualGets or sets a value indicating whether the parent object is virtual.
Public propertyIsZombieGets a value indicating whether the object exists.
Public propertyKindGets an enumeration value indicating the type of object.
Public propertyLanguageGets the programming language used to author the code.
Public propertyLocationGets the location of the object declaration.
Public propertyMustImplementGets or sets a value indicating whether or not the item is declared abstract and thus requires an implementation.
Public propertyNameGets or sets the name of the object.
Public propertyNamespaceGets an object defining the namespace.
Public propertyOverloadsGets a collection of overloaded methods for this item.
Public propertyParametersGets a collection of parameters for this item.
Public propertyParentGets the immediate parent object of a given object.
Public propertyPictureGets a picture automation object to be used as an icon in the user interface.
Public propertyProjectGets the Project associated with the object.
Public propertyProjectItemGets the ProjectItem object associated with the given object.
Public propertyPrototypeGets a string holding the stub definition of this object.
Public propertyReferencesNot currently implemented.
Public propertyStartPointGets a TextPoint object that defines the beginning of the code item.
Public propertyStartPointOfGets the start point of the parent object.
Public propertyTemplateParametersGets a collection of parameters contained in a class template.
Public propertyTemplatizationsInfrastructure. Internal Microsoft Use Only.
Public propertyTypeGets or sets an object representing the programmatic type.
Public propertyTypeStringGets or sets the type of object using a string representation of the type.

Public methodAddAttributeCreates a new attribute code construct and inserts the code in the correct location.
Public methodAddInitializerAdds a C++ initializer to a constructor's member initializer list.
Public methodAddParameterCreates a new parameter code construct and inserts the code in the correct location.
Public methodAddTemplateParameterAdds a parameter to a template definition.
Public methodGetEndPointGets a TextPoint object that marks the end of the code element definition.
Public methodGetStartPointGets a TextPoint object that defines the beginning of the code element definition.
Public methodIsSelfDetermines if the specified code element is the same as the parent code element.
Public methodRemoveParameterRemoves a parameter from the argument list.
Public methodRemoveTemplateParameterRemoves a parameter from a template definition.

The VCCodeFunction object provides code model functionality to existing Visual C++ IDE solutions at the function level. Primarily, this object is used to access or modify an existing function construct.


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

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

This example retrieves all functions in the solution and displays the name of each.

Sub GetFunctions()
    Dim vcCM as VCCodeModel
    Dim vcFunc as VCCodeFunction
    vcCM = DTE.Solution.Item(1).CodeModel
    For Each vcFunc in vcCM.Functions
End Sub