SelectedItems.Parent 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取集合的直接父对象 SelectedItems 。
public:
property EnvDTE::DTE ^ Parent { EnvDTE::DTE ^ get(); };
public:
property EnvDTE::DTE ^ Parent { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(2)]
public EnvDTE.DTE Parent { [System.Runtime.InteropServices.DispId(2)] get; }
[<System.Runtime.InteropServices.DispId(2)>]
[<get: System.Runtime.InteropServices.DispId(2)>]
member this.Parent : EnvDTE.DTE
Public ReadOnly Property Parent As 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);
}
}