动态添加一个新属性。DataConnectionProperties 选件类的当前实例本身识别的属性集合。
命名空间: Microsoft.VisualStudio.Data
程序集: Microsoft.VisualStudio.Data(在 Microsoft.VisualStudio.Data.dll 中)
语法
声明
Protected Function AddProperty ( _
descriptor As PropertyDescriptor, _
ParamArray attributes As Attribute() _
) As PropertyDescriptor
protected PropertyDescriptor AddProperty(
PropertyDescriptor descriptor,
params Attribute[] attributes
)
protected:
PropertyDescriptor^ AddProperty(
PropertyDescriptor^ descriptor,
... array<Attribute^>^ attributes
)
member AddProperty :
descriptor:PropertyDescriptor *
attributes:Attribute[] -> PropertyDescriptor
protected function AddProperty(
descriptor : PropertyDescriptor,
... attributes : Attribute[]
) : PropertyDescriptor
参数
- descriptor
类型:System.ComponentModel.PropertyDescriptor
提供此属性及其特性声明的 PropertyDescriptor 对象。
- attributes
类型:array<System.Attribute[]
将特性应用于属性。
返回值
类型:System.ComponentModel.PropertyDescriptor
返回一个新添加的属性的类型描述符。
异常
异常 | 条件 |
---|---|
ArgumentNullException | descriptor 参数为 null。 |
InvalidOperationException | 所指定的属性已存在。 |
备注
输入属性说明符是一个专用连接属性说明符包装,因此,返回值大于传递的一个实际上是不同的 PropertyDescriptor 实例。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。