共用方式為


DTE2.SelectedItems 屬性

取得包含目前環境中所選取之項目的集合。

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

語法

'宣告
ReadOnly Property SelectedItems As SelectedItems
SelectedItems SelectedItems { get; }
property SelectedItems^ SelectedItems {
    SelectedItems^ get ();
}
abstract SelectedItems : SelectedItems with get
function get SelectedItems () : SelectedItems

屬性值

類型:SelectedItems
SelectedItems 集合。

範例

Sub SelectedItemsExample(ByVal dte As DTE2)

    ' Before running this example, open a project and select some items 
    ' in Solution Explorer.

    Dim item As SelectedItem
    Dim msg As String

    For Each item In dte.SelectedItems
        msg &= item.Name & vbCrLf
    Next

    MsgBox("The following items are selected in Solution Explorer:" & _
        vbCrLf & vbCrLf & msg)

End Sub
public void SelectedItemsExample(DTE2 dte)
{
    // Before running this example, open a project and select some 
    // items in Solution Explorer.

    string msg = "";

    foreach (SelectedItem item in dte.SelectedItems)
        msg += item.Name + "\n";

    MessageBox.Show(
        "The following items are selected in Solution Explorer:\n\n" + 
        msg);
}

.NET Framework 安全性

請參閱

參考

DTE2 介面

EnvDTE80 命名空間

其他資源

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