次の方法で共有


Solution3.Parent プロパティ

Solution2 オブジェクトの直接の親オブジェクトを取得します。

名前空間:  EnvDTE90
アセンブリ:  EnvDTE90 (EnvDTE90.dll 内)

構文

'宣言
ReadOnly Property Parent As DTE
    Get
DTE Parent { get; }
property DTE^ Parent {
    DTE^ get ();
}
abstract Parent : DTE
function get Parent () : DTE

プロパティ値

型: EnvDTE.DTE
DTE オブジェクト。

実装

Solution2.Parent

解説

Parent プロパティは、オブジェクトの直接の親を返します。

このアドイン コードの実行方法については、「方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する」を参照してください。

Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    IsOpenExample(_applicationObject)
End Sub

Sub IsOpenExample(ByVal dte As DTE2)
    ' This add-in displays the parent of the solution.
    ' Open a solution in 
    ' Visual Studio before running this example.
    Try
        Dim soln As Solution3 = CType(_applicationObject.Solution, _
        Solution3)
        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 OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst,
 ref System.Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    ParentExample((DTE2)_applicationObject);
}
public void ParentExample(DTE2 dte)
{
    // This add-in displays the name of the parent for a solution. 
    // Open a solution in 
    // Visual Studio before running this example.
    try
    {
        Solution3 soln = (Solution3)_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);
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Solution3 インターフェイス

Parent オーバーロード

EnvDTE90 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する