Breakpoints.Item(Object) Method

Definition

Returns a Breakpoint object in a Breakpoints collection.

public:
 EnvDTE::Breakpoint ^ Item(Platform::Object ^ index);

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 + ".");  
}  

Remarks

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

Applies to