Breakpoints.Item(Object) Method

Definition

Returns a Breakpoint object in a Breakpoints collection.

public:
 EnvDTE::Breakpoint ^ Item(System::Object ^ index);
public:
 EnvDTE::Breakpoint ^ Item(Platform::Object ^ index);
EnvDTE::Breakpoint Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.Breakpoint Item (object index);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.Breakpoint
Public Function Item (index As Object) As Breakpoint

Parameters

index
Object

Required. The index of the Breakpoint object to return.

Returns

A Breakpoint object.

Attributes

Examples

The following example demonstrates how to use the Item method.

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

Remarks

The Item method throws a ArgumentException exception if the collection cannot find the object that corresponds to the index value.

Applies to