次の方法で共有


Property.Object プロパティ

Property オブジェクトをサポートするオブジェクトを設定または取得します。

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

構文

'宣言
Property Object As Object
Object Object { get; set; }
property Object^ Object {
    Object^ get ();
    void set (Object^ value);
}
abstract Object : Object with get, set
function get Object () : Object
function set Object (value : Object)

プロパティ値

型 : System.Object
Property オブジェクトの値を表すオブジェクト。

解説

アドインで Property.Object ではなく Property.Value を使用する場合は、Property オブジェクトから、Object 値ではなく Properties コレクションが返されます。つまり Property.Value が、入れ子になった Properties コレクションを返すように、Property.Object を使用して返される IDispatch はラップ処理されます。

' Visual Studio macro.
Sub ObjectExample3(ByVal dte As DTE2)

    ' Retrieve and display the text editor color setting for 
    ' code comments.
    Dim props As Properties = _
        dte.Properties("FontsAndColors", "TextEditor")
    Dim prop As [Property] = props.Item("FontsAndColorsItems")
    Dim items As FontsAndColorsItems = _
        CType(prop.Object, FontsAndColorsItems)
    Dim item As ColorableItems = items.Item("Comment")

    MsgBox(item.Name & " items have an OLE_COLOR value of " & _
        item.Foreground.ToString() & vbCrLf)

End Sub
public void ObjectExample(DTE2 dte)
{
    // Retrieve and display the text editor color setting for 
    // code comments.
    Properties props = 
        dte.get_Properties("FontsAndColors", "TextEditor");
    Property prop = props.Item("FontsAndColorsItems");
    FontsAndColorsItems items = (FontsAndColorsItems)prop.Object;
    ColorableItems item = items.Item("Comment");

    MessageBox.Show(item.Name + " items have an OLE_COLOR value of " + 
        item.Foreground.ToString() + "\n");
}

.NET Framework セキュリティ

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

参照

関連項目

Property インターフェイス

EnvDTE 名前空間

その他の技術情報

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