Aracılığıyla paylaş


Breakpoints.Item Yöntem

Döndürür bir Breakpoint , nesne bir Breakpoints koleksiyonu.

Ad alanı:  EnvDTE
Derleme:  EnvDTE (EnvDTE.dll içinde)

Sözdizimi

'Bildirim
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

Parametreler

  • index
    Tür: Object

    Gerekli.Dizini Breakpoint dönmek için nesne.

Dönüş Değeri

Tür: EnvDTE.Breakpoint
Breakpoint nesnesi

Notlar

Item Yöntemi throws bir ArgumentException koleksiyonu endeks değerine karşılık gelen nesne bulamazsa, özel durum.

Örnekler

Aşağıdaki örnek, nasıl kullanılacağını gösterir Item yöntemi.

Bu yöntem test etmek için:

  1. Hedef projeyi açın ve eklentiyi çalıştırın.
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 Güvenliği

Ayrıca bkz.

Başvuru

Breakpoints Arabirim

EnvDTE Ad Alanı

Diğer Kaynaklar

Nasıl yapılır: Otomasyon Nesne Modeli Kod Örnekleri Derleme ve Çalıştırma