共用方式為


Debugger3.Breakpoints 屬性

取得中斷點集合。

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

語法

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

屬性值

類型:Breakpoints
Breakpoints 集合。

備註

Breakpoints 可取得偵錯工具中所設定的全部中斷點之集合。 這個集合代表所有暫止中斷點的清單。 如需暫止中斷點和繫結中斷點的說明,請參閱 dbgBreakpointType

範例

在下列範例中,示範了如何使用 Breakpoints 屬性。

若要測試這個屬性:

  1. 開啟目標專案並執行增益集。
public static void Breakpoints(EnvDTE80.DTE2 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("Breakpoints 
    Property");
    owp.Activate();

    // dte is a reference to the DTE2 object passed to you by the
    // OnConnection method that you implement when you create an Add-
    // in.
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;

    // Set breakpoints.  
    debugger.Breakpoints.Add("","Target001.cs", 13, 1, "", 
        
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, 
        "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);
    debugger.Breakpoints.Add("","Target001.cs", 14, 1, "", 
        
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, 
        "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);            

    owp.OutputString("Number of breakpoints set: " + 
                     debugger.Breakpoints.Count + "\n");

    // List all breakpoints.
    foreach(EnvDTE90.Breakpoint3 bp in debugger.Breakpoints)
    {
        owp.OutputString(bp.Name + "\n");
    }
}
Sub ListAllBreakpoints()
    ' This function dumps the names of all the breakpoints 
    ' currently set to a new pane in the output window.
    Dim ow As OutputWindow
    ow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object

    Dim bppane As OutputWindowPane
    bppane = ow.OutputWindowPanes.Add("Debugger")

    Dim bps As Breakpoints
    bps = DTE.Debugger.Breakpoints

    If (bps.Count > 0) Then
        Dim bp As Breakpoint2
        For Each bp In bps
            bppane.OutputString(bp.Name + vbCrLf)
        Next
    Else
        bppane.OutputString("No breakpoints are set" + vbCrLf)
    End If
End Sub

.NET Framework 安全性

請參閱

參考

Debugger3 介面

EnvDTE90 命名空間