Udostępnij za pośrednictwem


Expression2.Parent Property

Gets the immediate parent object of an Expression2 object.

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

Syntax

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

Property Value

Type: EnvDTE.Debugger
A Debugger object.

Implements

Expression.Parent

Remarks

The Parent property returns the immediate parent to the Expression2 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();

    EnvDTE100.Expression2 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 EnvDTE100.Expression2 = 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

Expression2 Interface

Parent Overload

EnvDTE100 Namespace

Other Resources

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