Partager via


CodeEvent.Parent Property

Definition

Gets the immediate parent object of the CodeEvent object.

public:
 property System::Object ^ Parent { System::Object ^ get(); };
public:
 property Platform::Object ^ Parent { Platform::Object ^ get(); };
[System.Runtime.InteropServices.DispId(31)]
public object Parent { [System.Runtime.InteropServices.DispId(31)] get; }
[<System.Runtime.InteropServices.DispId(31)>]
[<get: System.Runtime.InteropServices.DispId(31)>]
member this.Parent : obj
Public ReadOnly Property Parent As Object

Property Value

A CodeClass2 object.

Attributes

Examples

The following example demonstrates how to use the Parent property.

public static void Parent(EnvDTE80.DTE2 dte)  
{  
    TextSelection objTextSel;  
    EnvDTE80.CodeEvent codeEvent;  
    objTextSel = (TextSelection)dte.ActiveDocument.Selection;  
    codeEvent = (EnvDTE80.CodeEvent)objTextSel.ActivePoint.get_CodeElement(vsCMElement.vsCMElementEvent);  

    MessageBox.Show("\nParent property: " +  
                    ((EnvDTE80.CodeClass2)codeEvent.Parent).Name,   
                      "Testing CodeEvent");  
}  

Remarks

Note

The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same.

Applies to