CodeFunction.FunctionKind Property

Gets an enumeration describing how a function is used.

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

vsCMFunction FunctionKind { get; }

Property Value

Type: EnvDTE.vsCMFunction
A vsCMFunction value.

FunctionKind returns the type of the function, such as a Property Get, a Property Let, a Sub, or a Function.

The vsCMFunction values are meant to be bitwise OR'd together. Visual C++ combines several of these values to accurately describe a function. For example: virtual int MyProc() const = 0;.

MyProc results in a value of (vsCMFunctionFunction | vsCMFunctionVirtual | vsCMFunctionConstant | vsCMFunctionPure | vsCMFunctionTopLevel).

Another example is : inline void AnotherOne().

This results in a value of (vsCMFunctionSub | vsCMFunctionInline, vsCMFunctionTopLevel).


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

 public void FunctionKindExample(DTE2 dte)
    // Before running this example, open a code document from a project
    // and place the insertion point inside a function.
        // Retrieve the CodeFunction at the insertion point.
        TextSelection sel = 
        CodeFunction fun = 

        MessageBox.Show(fun.Name + "'s kind is " + 
    catch (Exception ex)