动态添加一个新属性。此数据连接属性实例本身识别的属性集合。
命名空间: 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
参数
- name
类型:System.String
属性名称。
- type
类型:System.Type
属性的数据类型。
- attributes
类型:array<System.Attribute[]
设置属性附加到属性。
返回值
类型:System.ComponentModel.PropertyDescriptor
新添加的属性的类型描述符。
异常
异常 | 条件 |
---|---|
ArgumentNullException | name 和 type 参数为null。 |
InvalidOperationException | 所指定的属性已存在。 |
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。