Właściwość SelectedItem.DTE —

Pobiera obiekt rozszerzalności najwyższego poziomu.

Przestrzeń nazw:  EnvDTE
Zestaw:  EnvDTE (w EnvDTE.dll)

Składnia

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

Wartość właściwości

Typ: EnvDTE.DTE
A DTE object.

Uwagi

W Visual Studio, DTE obiekt jest katalogu głównego modelu automatyzacji, który innych modeli obiektów często call "Aplikacja".

Przykłady

public void CodeExample(DTE2 dte)
{  
    try
    {
        // Open project and select one or more items in the
        // solution explorer before running this example.
        SelectedItem selItem;
        string msg = "";
        if (dte.SelectedItems.Count > 0)
        {
            selItem = dte.SelectedItems.Item(1);
            msg = "The first selected item is " + selItem.Name;
            msg += "\nThis SelectedItem corresponds to the following ProjectItem: " + selItem.ProjectItem.Name;
            msg += "\nThis SelectedItem is part of a collection of " + selItem.Collection.Count.ToString() + " items.";
            msg += "\nThis is contained in the following application: " + selItem.DTE.Name;
        }
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

SelectedItem Interfejs

Przestrzeń nazw EnvDTE

Inne zasoby

Porady: kompilowanie i uruchamianie kodu modelu obiektów automatyzacji — przykłady