Partager via


Command.DTE, propriété

Obtient l'objet d'extensibilité de niveau supérieur.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

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

Valeur de propriété

Type : EnvDTE.DTE
Objet DTE.

Notes

Dans Visual Studio, l'objet DTE est à la base du modèle Automation que les autres modèles objet appellent souvent "Application".

Exemples

public void CodeExample(DTE2 dte, AddIn addin)
{
    try
    {
        // Show number of commands in Commands collection.
        MessageBox.Show(dte.Commands.Count.ToString());
        // Return the Commands collection for the application.
        Commands cmdsColl = dte.Commands;
        // Return a Command object.
        Command cmdObj = cmdsColl.Item("File.NewFile", cmdsColl.Count);
        // Show the full name of Command object's application object.
        MessageBox.Show(cmdObj.DTE.FullName);
        // Display the Command object's name.
        MessageBox.Show(cmdObj.Name);
        // Display whether the Command object's containing collection
        // is the same as the application object's Commands collection.
        string message;
        if (cmdsColl.Equals(cmdObj.Collection))
            message = "Same collection!";
        else
            message = "Different collection!";
        MessageBox.Show(message);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Sécurité .NET Framework

Voir aussi

Référence

Command Interface

EnvDTE, espace de noms

Autres ressources

Comment : compiler et exécuter les exemples de code du modèle objet Automation