Udostępnij za pośrednictwem


Expressions.Parent Property

Gets the immediate parent object of a Expressions collection.

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

Syntax

'Declaration
ReadOnly Property Parent As Debugger
'Usage
Dim instance As Expressions 
Dim value As Debugger 

value = instance.Parent
Debugger Parent { get; }
property Debugger^ Parent {
    Debugger^ get ();
}
function get Parent () : Debugger

Property Value

Type: EnvDTE.Debugger
A Debugger object.

Remarks

The Parent property returns the immediate parent to the Expressions collection.

Examples

The following example demonstrates how to use the Parent property.

To test this property:

  1. The target application must contain a class A. The function Main must create an instance of a class A called "a".

  2. Set a breakpoint in the function Main after an instance of class A is created and its member variables are initialized.

  3. Run the target application in the debug mode.

  4. 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("a", true, 1);
    EnvDTE.Expressions exps = exp.DataMembers;
    owp.OutputString("\nExpression count: " + exps.Count);
    owp.OutputString("\nEdition of the environment: " + exps.DTE.Edition);
    owp.OutputString("\nThe name of the current program: " + 
                     exps.Parent.CurrentProgram.Name);
    owp.OutputString("\nSecond expression: " + exps.Item(2).Name);
}
Shared Sub Parent(ByRef dte As EnvDTE.DTE)
    Dim exp As EnvDTE.Expression = dte.Debugger.GetExpression("a", True, 1)
    Dim exps As EnvDTE.Expressions = exp.DataMembers
    Dim str As String = vbCrLf
    str = "Expression count: " + exps.Count.ToString()
    str += vbCrLf + "Edition of the environment: " + exps.DTE.Edition
    str += vbCrLf + "The name of the current program: " + _
           exps.Parent.CurrentProgram.Name
    str += vbCrLf + "Second expression: " + exps.Item(2).Name
    MessageBox.Show(str, "Expression Test - Expressions Properties")
End Sub

.NET Framework Security

See Also

Reference

Expressions Interface

Expressions Members

EnvDTE Namespace

Other Resources

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