获取一个描述函数使用方法的枚举。
命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)
语法
声明
ReadOnly Property FunctionKind As vsCMFunction
    Get
vsCMFunction FunctionKind { get; }
property vsCMFunction FunctionKind {
    vsCMFunction get ();
}
abstract FunctionKind : vsCMFunction
function get FunctionKind () : vsCMFunction
属性值
类型:EnvDTE.vsCMFunction
一个 vsCMFunction 值。
备注
FunctionKind 返回函数的类型,如,Property Get、Property Let、Sub 或 Function。
vsCMFunction 值设计为一起执行按位“或”运算。 Visual C++ 会组合这些值中的几个值以准确描述一个函数。 例如:virtual int MyProc() const = 0;。
MyProc 生成值 (vsCMFunctionFunction | vsCMFunctionVirtual | vsCMFunctionConstant | vsCMFunctionPure | vsCMFunctionTopLevel)。
另一个示例是:inline void AnotherOne()。
这将生成 (vsCMFunctionSub | vsCMFunctionInline, vsCMFunctionTopLevel) 的值。
提示
在进行某些类型的编辑之后,代码模型元素(如类、结构、函数、特性、委托等)的值可能是非确定性的,这意味着不能指望它们的值总是保持不变。 有关更多信息,请参见 使用代码模型查找代码 (Visual Basic) 中的“代码模型元素的值可能会更改”一节。
示例
 Sub FunctionKindExample(ByVal dte As DTE2)
    ' 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.
        Dim sel As TextSelection = _
            CType(dte.ActiveDocument.Selection, TextSelection)
        Dim fun As CodeFunction = _
            CType(sel.ActivePoint.CodeElement( _
            vsCMElement.vsCMElementFunction), CodeFunction)
        MsgBox(fun.Name & "'s kind is " & fun.FunctionKind.ToString())
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub
 public void FunctionKindExample(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 kind is " + 
            fun.FunctionKind.ToString());
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。