SelectedItem.DTE 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取顶级扩展性对象。
public:
property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
public:
property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(2)]
public EnvDTE.DTE DTE { [System.Runtime.InteropServices.DispId(2)] get; }
[<System.Runtime.InteropServices.DispId(2)>]
[<get: System.Runtime.InteropServices.DispId(2)>]
member this.DTE : EnvDTE.DTE
Public ReadOnly Property DTE As DTE
属性值
DTE 对象。
- 属性
示例
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);
}
}
注解
在中 Visual Studio , DTE 对象是自动化模型的根,其他对象模型通常会调用 "应用程序"。