다음을 통해 공유


Command.DTE Property

Definition

Gets the top-level extensibility object.

public:
 property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
public:
 property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(3)]
public EnvDTE.DTE DTE { [System.Runtime.InteropServices.DispId(3)] get; }
[<System.Runtime.InteropServices.DispId(3)>]
[<get: System.Runtime.InteropServices.DispId(3)>]
member this.DTE : EnvDTE.DTE
Public ReadOnly Property DTE As DTE

Property Value

DTE

A DTE object.

Attributes

Examples

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);  
    }  
}  

Remarks

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

Applies to