Solution4.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

DTE 对象。

实现

属性

示例

Sub IsOpenExample(ByVal dte As DTE2)  
    ' Display the parent of the solution.  
    ' Open a solution in Visual Studio before running this example.  
    Try  
        Dim soln As Solution4 = CType(_applicationObject.Solution, _  
        Solution4)  
        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  
using System.Windows.Forms;  
public void ParentExample(DTE2 dte)  
{  
    // Display the name of the parent for a solution.   
    // Open a solution in Visual Studio before running this example.  
    try  
    {  
        Solution4 soln = (Solution4)_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属性将直接父级返回给对象。

适用于