共用方式為


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

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

命名空間:  Microsoft.VisualStudio.Data.Framework
組件:  Microsoft.VisualStudio.Data.Framework (在 Microsoft.VisualStudio.Data.Framework.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

參數

  • name
    類型:String

    屬性名稱。

  • type
    類型:Type

    屬性的資料型別。

  • attributes
    類型:array<Attribute[]

    附加的一組屬性的屬性。

傳回值

類型:PropertyDescriptor
新加入之屬性的描述項。

例外狀況

例外狀況 條件
ArgumentNullException

name 和 type 參數為 nullnull 參考 (即 Visual Basic 中的 Nothing)。

ArgumentException

指定的屬性已經存在。

.NET Framework 安全性

請參閱

參考

DataConnectionProperties 類別

AddProperty 多載

Microsoft.VisualStudio.Data.Framework 命名空間

RemoveProperty