SelectedItems.DTE Property

Gets the top-level extensibility object.

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

Syntax

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

Property Value

Type: EnvDTE.DTE
A DTE object.

Remarks

In Visual Studio, the DTE object is the root of the automation model, which other object models often call "Application."

Examples

public void CodeExample(DTE2 dte)
{  
    try
    {
        // Open project and select one or more items in 
        // Solution Explorer before running this example.
        SelectedItem selItem;
        SelectedItems selItems;
        string msg = "";
        if (dte.SelectedItems.Count > 0)
        {
            selItems = dte.SelectedItems;
            selItem = selItems.Item(1);
            msg = "The first selected item is " + selItem.Name;
            msg += "\n Do the Parent and DTE property return the same object? " + (selItems.DTE.Equals(selItems.Parent)).ToString();
        }
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework Security

See Also

Reference

SelectedItems Interface

EnvDTE Namespace

Other Resources

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