VCCodeTypedef.IsSelf 方法

确定指定的代码元素是否与该代码元素相同。

命名空间:  Microsoft.VisualStudio.VCCodeModel
程序集:  Microsoft.VisualStudio.VCCodeModel(在 Microsoft.VisualStudio.VCCodeModel.dll 中)

语法

声明
Function IsSelf ( _
    pOther As Object _
) As Boolean
bool IsSelf(
    Object pOther
)
bool IsSelf(
    [InAttribute] Object^ pOther
)
abstract IsSelf : 
        pOther:Object -> bool
function IsSelf(
    pOther : Object
) : boolean

参数

  • pOther
    类型:Object

    必选。 该代码元素要与其进行比较的代码元素。

返回值

类型:Boolean
如果指定的代码元素与父代码元素相同,则为 true;否则为 false。

备注

有关如何编译和运行此示例的信息,请参见 如何:编译 Visual C++ 代码模型扩展性的示例代码

示例

此比较两个代码元素。 如果它们表示同一对象消息显示。

Sub IsSameObject()
    Dim vcElements As VCCodeElements
    Dim codeElem1 As VCCodeElement
    Dim codeElem2 As VCCodeElement
    vcElements = DTE.Solution.Item(1).CodeModel.Classes
    codeElem1 = vcElements.Item(1)
    codeElem2 = vcElements.Item(2)
    If (codeElem1.IsSelf(codeElem2)) Then
        MsgBox(codeElem1.Name + " and " + codeElem2.Name + " represent the same object.")
    End If
End Sub

.NET Framework 安全性

请参阅

参考

VCCodeTypedef 接口

Microsoft.VisualStudio.VCCodeModel 命名空间