This documentation is archived and is not being maintained.

CodeFunction.Type Property

Sets or gets an object representing the programmatic type.

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

CodeTypeRef Type { get; set; }
/** @property */
CodeTypeRef get_Type ()

/** @property */
void set_Type (CodeTypeRef ppCodeTypeRef)

function get Type () : CodeTypeRef

function set Type (ppCodeTypeRef : CodeTypeRef)

Property Value

A CodeTypeRef object.

Type may return Nothing for languages that have a notion of a default type.


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 with the Code Model (Visual Basic).

 public void TypeExample(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 return type is " + 
    catch (Exception ex)