共用方式為


DataConnectionProperties.AddProperty 方法 (String, Type, array<Attribute )

動態地將新屬性加入至這個資料連接屬性執行個體原本就可辨認屬性的集合。

命名空間:  Microsoft.VisualStudio.Data
組件:  Microsoft.VisualStudio.Data (在 Microsoft.VisualStudio.Data.dll 中)

語法

'宣告
Protected Function AddProperty ( _
    name As String, _
    type As Type, _
    ParamArray attributes As Attribute() _
) As PropertyDescriptor
protected PropertyDescriptor AddProperty(
    string name,
    Type type,
    params Attribute[] attributes
)
protected:
PropertyDescriptor^ AddProperty(
    String^ name, 
    Type^ type, 
    ... array<Attribute^>^ attributes
)
member AddProperty : 
        name:string * 
        type:Type * 
        attributes:Attribute[] -> PropertyDescriptor 
protected function AddProperty(
    name : String, 
    type : Type, 
    ... attributes : Attribute[]
) : PropertyDescriptor

參數

  • attributes
    型別:array<System.Attribute[]
    附加的一組屬性為屬性。

傳回值

型別:System.ComponentModel.PropertyDescriptor
新加入的屬性描述項。

例外狀況

例外狀況 條件
ArgumentNullException

name 和 type 參數為 null。

InvalidOperationException

指定的屬性已存在。

.NET Framework 安全性

請參閱

參考

DataConnectionProperties 類別

AddProperty 多載

Microsoft.VisualStudio.Data 命名空間

RemoveProperty