_DTE.SelectedItems 属性
获取一个包含当前在环境中选定的项的集合。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
ReadOnly Property SelectedItems As SelectedItems
SelectedItems SelectedItems { get; }
property SelectedItems^ SelectedItems {
SelectedItems^ get ();
}
abstract SelectedItems : SelectedItems with get
function get SelectedItems () : SelectedItems
属性值
类型:EnvDTE.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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。