Expression.Parent 屬性

取得 Expression 物件的直接上層父物件。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

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

屬性值

型別:EnvDTE.Debugger
Debugger 物件。

備註

Parent 屬性將直接上層父代傳回 Expression 物件。如果您想取得包含的集合,請使用 Collection 屬性。

範例

下列範例示範如何使用 Parent 屬性。

若要測試這個屬性:

  1. 在目標應用程式中設定中斷點。

  2. 在偵錯模式執行目標應用程式。

  3. 當應用程式在中斷點停止時,請執行增益集。

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 安全性

請參閱

參考

Expression 介面

EnvDTE 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例