Property.Object 属性

定义

设置或获取支持对象的对象 Property

public:
 property System::Object ^ Object { System::Object ^ get(); void set(System::Object ^ value); };
public:
 property Platform::Object ^ Object { Platform::Object ^ get(); void set(Platform::Object ^ value); };
[System.Runtime.InteropServices.DispId(45)]
public object Object { [System.Runtime.InteropServices.DispId(45)] get; [System.Runtime.InteropServices.DispId(45)] set; }
[<System.Runtime.InteropServices.DispId(45)>]
[<get: System.Runtime.InteropServices.DispId(45)>]
[<set: System.Runtime.InteropServices.DispId(45)>]
member this.Object : obj with get, set
Public Property Object As Object

属性值

Object

表示对象的值的对象 Property

属性

示例

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");  
}  

注解

如果你使用 Property.Value 而不是 Property.Object ,则 Property 对象将返回一个 Properties 集合而不是一个 Object 值。 也就是说,将 IDispatch 通过包装返回的, Property.Object 以便 Property.Value 返回嵌套 Properties 集合。

适用于