共用方式為


VSProjectItem.DTE Property

Definition

Returns 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(1)]
public EnvDTE.DTE DTE { [System.Runtime.InteropServices.DispId(1)] get; }
[<System.Runtime.InteropServices.DispId(1)>]
[<get: System.Runtime.InteropServices.DispId(1)>]
member this.DTE : EnvDTE.DTE
Public ReadOnly Property DTE As DTE

Property Value

DTE

Returns a DTE object.

Attributes

Examples

Public Sub PrjDTE(ByVal dte As DTE2)  
    ' List the parent object for the first VSProjectItem.  
    ' Before running, open a VB or C# application in VS.  
    Dim vsPrj As VSProject = _  
    CType(dte.Solution.Projects.Item(1).Object, _  
    VSProject)  
    Dim vsPrjItem As VSProjectItem  

    vsPrjItem = CType(dte.Solution.Projects.Item(1) _  
    .ProjectItems.Item(1).Object, VSProjectItem)  
    MsgBox("Parent object for VSProjectItem: " & vsPrjItem.DTE)  
End Sub  
public void PrjDTE(DTE2 dte)  
{  
    // Lists the parent object for the first VSProjectItem.  
    // Before running, open a VB or C# application in VS.  
    VSProject vsPrj = (VSProject)dte.Solution.  
    Projects.Item(1).Object;  
    VSProjectItem vsPrjItem;  

    vsPrjItem = (VSProjectItem)dte.Solution.  
    Projects.Item(1).ProjectItems.Item(1).Object;  
    MessageBox.Show("Parent object for VSProjectItem" + vsPrjItem.DTE);  
}  

Remarks

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

Applies to