다음을 통해 공유


DTE2.SelectedItems Property

Gets a collection containing the items currently selected in the environment.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

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

Property Value

Type: EnvDTE.SelectedItems
A SelectedItems collection.

Examples

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 Security

See Also

Reference

DTE2 Interface

EnvDTE80 Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples