Solution2.Parent Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Получает непосредственный родительский объект для объекта Solution2.
public:
property EnvDTE::DTE ^ Parent { EnvDTE::DTE ^ get(); };
public:
property EnvDTE::DTE ^ Parent { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(11)]
public EnvDTE.DTE Parent { [System.Runtime.InteropServices.DispId(11)] get; }
[<System.Runtime.InteropServices.DispId(11)>]
[<get: System.Runtime.InteropServices.DispId(11)>]
member this.Parent : EnvDTE.DTE
Public ReadOnly Property Parent As DTE
Значение свойства
Объект DTE.
Реализации
- Атрибуты
Примеры
Sub IsOpenExample(ByVal dte As DTE2)
' Displays the parent of the solution.
' Open a solution in Visual Studio before running this example.
Try
Dim soln As Solution2 = CType(_applicationObject.Solution, _
Solution2)
Dim solnName As String = _
System.IO.Path.GetFileNameWithoutExtension(soln.FullName)
MsgBox("Solution " & solnName & _
" has the following parent:" & _
vbCrLf & vbCrLf & soln.Parent.FullName)
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
//you will need to add this reference to your project as well
using System.Windows.Forms;
public void ParentExample(DTE2 dte)
{
// Displays the name of the parent for a solution.
// Open a solution in Visual Studio before running this example.
try
{
Solution2 soln = (Solution2)_applicationObject.Solution;
string solnName =
System.IO.Path.GetFileNameWithoutExtension(soln.FullName);
MessageBox.Show("Solution " + solnName + "'s parent is: "
+ soln.Parent.FullName.ToString());
}
catch(SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}
Комментарии
ParentСвойство возвращает ближайший родительский объект для объекта.