共用方式為


Expression.Parent Property

Definition

Gets the immediate parent object of an Expression object.

public:
 property EnvDTE::Debugger ^ Parent { EnvDTE::Debugger ^ get(); };
public:
 property EnvDTE::Debugger ^ Parent { EnvDTE::Debugger ^ get(); };
[System.Runtime.InteropServices.DispId(201)]
public EnvDTE.Debugger Parent { [System.Runtime.InteropServices.DispId(201)] get; }
[<System.Runtime.InteropServices.DispId(201)>]
[<get: System.Runtime.InteropServices.DispId(201)>]
member this.Parent : EnvDTE.Debugger
Public ReadOnly Property Parent As Debugger

Property Value

A Debugger object.

Attributes

Examples

The following example demonstrates how to use the Parent property.

public static void Parent(DTE dte)  
{  
    // Setup debug Output window.  
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);  
    w.Visible = true;  
    OutputWindow ow = (OutputWindow)w.Object;  
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Parent Property Test");  
    owp.Activate();  

    EnvDTE.Expression exp = dte.Debugger.GetExpression("tempC", true, 1);  
    owp.OutputString("The name of the current program: " + exp.Parent.CurrentProgram.Name);  
}  
Shared Sub Parent(ByRef dte As EnvDTE.DTE)  
    Dim exp As EnvDTE.Expression = dte.Debugger.GetExpression("tempC", True, 1)  
    MessageBox.Show("The name of the current program: " + _  
                    exp.Parent.CurrentProgram.Name, _  
                    "Expression Test - Parent Property")  
End Sub  

Remarks

The Parent property returns the immediate parent to the Expression object. If you want to get the containing collection, then use the Collection property.

Applies to