Languages.Parent 属性

获取给定 Languages 集合的直接父对象。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

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

属性值

类型:EnvDTE.Debugger
一个 Debugger 对象。

示例

下面的示例演示如何使用 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.Languages languages = dte.Debugger.Languages;
    owp.OutputString("\nEdition of the environment: " + languages.DTE.Edition);
    owp.OutputString("\nThird language in the language collection: " + 
                     languages.Item(3).Name);
    owp.OutputString("\nThe name of the current program: " + 
                     languages.Parent.CurrentProgram.Name);
}
Shared Sub Parent(ByRef dte As EnvDTE.DTE)
    Dim languages As EnvDTE.Languages = dte.Debugger.Languages
    Dim str As String = vbCrLf
    str = "Edition of the environment: " + languages.DTE.Edition
    str += vbCrLf + vbCrLf + "Third language in the language collection: "
    str += languages.Item(3).Name
    str += vbCrLf + vbCrLf + "The name of the current program: " + _
           languages.Parent.CurrentProgram.Name
    MessageBox.Show(str, "Language Test - Parent Property")
End Sub

.NET Framework 安全性

请参见

参考

Languages 接口

EnvDTE 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例