共用方式為


Breakpoint2.File 屬性

取得含有中斷點的檔案名稱。

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

語法

'宣告
ReadOnly Property File As String
string File { get; }
property String^ File {
    String^ get ();
}
abstract File : string
function get File () : String

屬性值

型別:System.String
字串,包含含有中斷點的檔案名稱。

範例

下列範例示範如何使用 File 屬性。

若要測試這個屬性:

  1. 請在目標應用程式中設定中斷點。

  2. 執行增益集。

public static void File(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("File 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.
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;
    owp.OutputString("Breakpoint in the file " + debugger.Breakpoints.Item(1).File);
    owp.OutputString(" on line " +
                     debugger.Breakpoints.Item(1).FileLine.ToString() + " column ");
    owp.OutputString(debugger.Breakpoints.Item(1).FileColumn.ToString() + " is ");
    owp.OutputString(debugger.Breakpoints.Item(1).Enabled ? "enabled." : "disabled.");
    owp.OutputString("\nThis breakpoint is in the function: " +
                     debugger.Breakpoints.Item(1).FunctionName);
}
Sub FileExample(ByVal dte As DTE2)

    ' NOTE: This example requires a reference to the 
    '       System.Collections namespace.

    ' Before running this example, open a project.
    Dim list As New SortedList()
    Dim brk As Breakpoint
    For Each brk In dte.Debugger.Breakpoints
        If brk.Enabled Then
            list(brk.File) = brk.File
        End If
    Next

    Dim file As DictionaryEntry
    Dim files As String
    For Each file In list
        files &= file.Value.ToString() & vbCrLf
    Next

    MsgBox("The following files have active breakpoints:" & _
        vbCrLf & vbCrLf & files)

End Sub

.NET Framework 安全性

請參閱

參考

Breakpoint2 介面

File 多載

EnvDTE80 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例