Share via


Breakpoints.Item 메서드

Breakpoints 컬렉션의 Breakpoint 개체를 반환합니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Function Item ( _
    index As Object _
) As Breakpoint
Breakpoint Item(
    Object index
)
Breakpoint^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Breakpoint
function Item(
    index : Object
) : Breakpoint

매개 변수

  • index
    형식: Object

    필수입니다. 반환할 Breakpoint 개체의 인덱스입니다.

반환 값

형식: EnvDTE.Breakpoint
Breakpoint 개체

설명

Item 메서드는 컬렉션에서 인덱스 값에 해당하는 개체를 찾지 못하면 ArgumentException 예외를 throw합니다.

예제

다음 예제에서는 Item 메서드를 사용하는 방법을 보여 줍니다.

이 메서드를 테스트하려면

  1. 대상 프로젝트를 열고 추가 기능을 실행합니다.
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();

    // dte is a reference to the DTE object passed to you by the
    // OnConnection method that you implement when you create an add-in.
    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

.NET Framework 보안

참고 항목

참조

Breakpoints 인터페이스

EnvDTE 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행