Freigeben über


VCCodeDelegate.IsSelf Method

Determines if the specified code element is the same as the parent code element.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

'Declaration
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

Parameters

  • pOther
    Type: System.Object

    Required. The code element to which the specified code element is being compared.

Return Value

Type: System.Boolean
true if the specified code element is the same as the parent code element; otherwise, false.

Remarks

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

Examples

This example compares two code elements. If they represent the same object, a message is displayed.

[Visual Basic]

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 Security

See Also

Reference

VCCodeDelegate Interface

Microsoft.VisualStudio.VCCodeModel Namespace