共用方式為


Breakpoints.Parent Property

Definition

Returns the parent Debugger object of a given Breakpoints collection.

public:
 property EnvDTE::Debugger ^ Parent { EnvDTE::Debugger ^ get(); };
public:
 property EnvDTE::Debugger ^ Parent { EnvDTE::Debugger ^ get(); };
[System.Runtime.InteropServices.DispId(2)]
public EnvDTE.Debugger Parent { [System.Runtime.InteropServices.DispId(2)] get; }
[<System.Runtime.InteropServices.DispId(2)>]
[<get: System.Runtime.InteropServices.DispId(2)>]
member this.Parent : EnvDTE.Debugger
Public ReadOnly Property Parent As Debugger

Property Value

A Debugger object.

Attributes

Examples

The following example demonstrates how to use the Parent property.

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.Debugger debugger = (EnvDTE.Debugger)dte.Debugger;  
    debugger.Breakpoints.Add("","Target001.cs", 13, 1, "",   
                             EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue,   
                             "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);  
    debugger.Breakpoints.Add("","Target001.cs", 15, 1, "",   
                             EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue,   
                             "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);  

    owp.OutputString("\nNumber of Breakpoints: " + debugger.Breakpoints.Count);  
    owp.OutputString("\nEdition of the environment: " +   
                     debugger.Breakpoints.DTE.Edition);  
    owp.OutputString("\nParent's Current Mode: " +   
                     debugger.Breakpoints.Parent.CurrentMode);  
    owp.OutputString("\nFirst breakpoint is on line " +   
                     debugger.Breakpoints.Item(1).FileLine + ".");  
    owp.OutputString("\nSecond breakpoint is on line " +   
                     debugger.Breakpoints.Item(2).FileLine + ".");  
}  
Shared Sub Parent(ByRef dte As EnvDTE.DTE)  
    Dim str As String  
    dte.Debugger.Breakpoints.Add("", "Target001.cs", 13, 1, "", _  
                                 EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _  
                                 "C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)  
    dte.Debugger.Breakpoints.Add("", "Target001.cs", 15, 1, "", _  
                                 EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _  
                                 "C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)  
    str = "Number of Breakpoints: " + dte.Debugger.Breakpoints.Count.ToString() + vbCrLf  
    str += "Edition of the environment: " + dte.Debugger.Breakpoints.DTE.Edition + vbCrLf  
    str += "Parent's Current Mode: " + dte.Debugger.Breakpoints.Parent.CurrentMode.ToString() + vbCrLf  
    str += "First breakpoint is on line " + dte.Debugger.Breakpoints.Item(1).FileLine.ToString() + "." + vbCrLf  
    str += "Second breakpoint is on line " + dte.Debugger.Breakpoints.Item(2).FileLine.ToString() + "." + vbCrLf  
    MessageBox.Show(str, "Parent Property Test")  
End Sub  

Remarks

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

Applies to