VCCodeInterface::IsSelf Method (Object^)
Visual Studio 2015
Determines if the specified code element is the same as another code element.
Assembly: Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Parameters
- pOther
-
Type:
System::Object^
Required. The code element being compared to.
Return Value
Type: System::Booleantrue if the specified code element is the same as another code element; otherwise, false.
See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.
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
Show: