다음을 통해 공유


VCCodeUnion.IsSelf(Object) Method

Definition

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

public:
 bool IsSelf(System::Object ^ pOther);
public:
 bool IsSelf(Platform::Object ^ pOther);
bool IsSelf(winrt::Windows::Foundation::IInspectable const & pOther);
[System.Runtime.InteropServices.DispId(518)]
public bool IsSelf (object pOther);
[<System.Runtime.InteropServices.DispId(518)>]
abstract member IsSelf : obj -> bool
Public Function IsSelf (pOther As Object) As Boolean

Parameters

pOther
Object

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

Returns

true if the specified code element is the same as the code element; otherwise, false.

Attributes

Examples

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

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  

Remarks

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

Applies to