次の方法で共有


ProjectItems.Item メソッド

ProjectItems コレクション内の ProjectItem オブジェクトを返します。

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

構文

'宣言
Function Item ( _
    index As Object _
) As ProjectItem
ProjectItem Item(
    Object index
)
ProjectItem^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> ProjectItem 
function Item(
    index : Object
) : ProjectItem

パラメーター

戻り値

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

解説

Index に渡される値は、ProjectItems コレクション内の ProjectItem オブジェクトへのインデックスである整数、またはコレクション内の ProjectItem オブジェクトの UniqueName です。

Item メソッドは、コレクションがインデックス値または UniqueName 値に対応するオブジェクトを見つけられない場合に ArgumentException 例外をスローします。

' Before running, create a solution with an empty project named 
' "Project1".
Sub ThrowArgumentException()
    ' Projects of the current solution.
    Dim cprojects As Projects = DTE.Solution.Projects   
    Dim project1 As Project = cprojects.Item(1)
    Debug.Assert(cprojects.Item(project1.UniqueName) Is project1)
End Sub

.NET Framework セキュリティ

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

参照

参照

ProjectItems インターフェイス

EnvDTE 名前空間

その他の技術情報

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