Expression.Parent Property

Gets the immediate parent object of an Expression object.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
ReadOnly Property Parent As Debugger
Debugger Parent { get; }
property Debugger^ Parent {
    Debugger^ get ();
}
abstract Parent : Debugger with get
function get Parent () : Debugger

Property Value

Type: EnvDTE.Debugger
A Debugger object.

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.

Examples

The following example demonstrates how to use the Parent property.

To test this property:

  1. Set a breakpoint in your target application.

  2. Run the target application in the debug mode.

  3. When the application stops at the breakpoint, run the add-in.

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

.NET Framework Security

See Also

Reference

Expression Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples