SelectedItems.DTE 属性

定义

获取顶级扩展性对象。

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

属性值

DTE

DTE 对象。

属性

示例

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

注解

在中 Visual Studio , DTE 对象是自动化模型的根,其他对象模型通常会调用 "应用程序"。

适用于