次の方法で共有


Properties.Item メソッド

更新 : 2007 年 11 月

Properties コレクションのインデックス付きメンバを返します。

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

構文

'宣言
Function Item ( _
    index As Object _
) As Property
'使用
Dim instance As Properties
Dim index As Object
Dim returnValue As [Property]

returnValue = instance(index)
Property Item(
    Object index
)
Property^ Item(
    [InAttribute] Object^ index
)
function Item(
    index : Object
) : Property

パラメータ

  • index
    型 : System.Object

    必ず指定します。返す Property オブジェクトのインデックス。

戻り値

型 : EnvDTE.Property

Property オブジェクト。

解説

Index に渡される値は、Properties コレクション内の Property オブジェクトへのインデックス値、またはコレクション内の Property オブジェクトの名前です。

指定した値がコレクションで見つからない場合、Item メソッドは、ArgumentException 例外をスローします。

public void CodeExample(DTE2 dte)
{  
    try
    {   // Open a solution before running this example
        Properties props = dte.Solution.Properties;
        Property prop;
        string msg;
        msg = "How many properties are there in the current solution: " + props.Count.ToString();
        msg += "\nThe application containing this Properties collection is " + props.DTE.Name;
        msg += "\nThe parent object of the Properties collection is a " + ((Solution)props.Parent).FullName;
        msg += "\nThe application property returns : " + ((DTE2)props.Application).Name;
        if (props.Count > 0)
        {
            prop = props.Item(1);
            msg += "\nThe first Property in the Properties collection is " + prop.Name;
        }
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

アクセス許可

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

参照

参照

Properties インターフェイス

Properties メンバ

EnvDTE 名前空間

その他の技術情報

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