Export (0) Print
Expand All

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.

NoteNote

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.
    try
    {
        // Retrieve the CodeFunction at the insertion point.
        TextSelection sel = 
            (TextSelection)dte.ActiveDocument.Selection;
        CodeFunction fun = 
            (CodeFunction)sel.ActivePoint.get_CodeElement(
            vsCMElement.vsCMElementFunction);

        MessageBox.Show(fun.Name + "'s return type is " + 
            fun.Type.AsFullName);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft