Compartir a través de


Breakpoints.Count Property

Definition

Returns a value indicating the number of Breakpoint objects in the Breakpoints collection.

public:
 property int Count { int get(); };
public:
 property int Count { int get(); };
[System.Runtime.InteropServices.DispId(3)]
public int Count { [System.Runtime.InteropServices.DispId(3)] get; }
[<System.Runtime.InteropServices.DispId(3)>]
[<get: System.Runtime.InteropServices.DispId(3)>]
member this.Count : int
Public ReadOnly Property Count As Integer

Property Value

An integer value representing the number of Breakpoint objects in the collection.

Attributes

Examples

The following example demonstrates how to use the Count property.

To test this property:

public static void Count(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("Count 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 Count(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, "Count Property Test")  
End Sub  

Applies to