AttributeProviderAttribute 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 AttributeProviderAttribute 类的新实例。
重载
| 名称 | 说明 |
|---|---|
| AttributeProviderAttribute(String) |
使用给定的类型名称初始化类的新实例 AttributeProviderAttribute 。 |
| AttributeProviderAttribute(Type) |
使用给定类型初始化类的新实例 AttributeProviderAttribute 。 |
| AttributeProviderAttribute(String, String) |
使用给定的类型名称和属性名称初始化类的新实例 AttributeProviderAttribute 。 |
AttributeProviderAttribute(String)
使用给定的类型名称初始化类的新实例 AttributeProviderAttribute 。
public:
AttributeProviderAttribute(System::String ^ typeName);
public AttributeProviderAttribute(string typeName);
new System.ComponentModel.AttributeProviderAttribute : string -> System.ComponentModel.AttributeProviderAttribute
Public Sub New (typeName As String)
参数
- typeName
- String
要指定的类型的名称。
例外
typeName 是 null。
另请参阅
适用于
AttributeProviderAttribute(Type)
使用给定类型初始化类的新实例 AttributeProviderAttribute 。
public:
AttributeProviderAttribute(Type ^ type);
public AttributeProviderAttribute(Type type);
new System.ComponentModel.AttributeProviderAttribute : Type -> System.ComponentModel.AttributeProviderAttribute
Public Sub New (type As Type)
参数
- type
- Type
要指定的类型。
例外
type 是 null。
示例
下面的代码示例演示如何使用AttributeProviderAttribute特定类型的DataSource属性标记IListSource属性。 有关完整代码列表,请参阅如何:在Windows Forms控件中应用属性。
[Category("Data")]
[Description("Indicates the source of data for the control.")]
[RefreshProperties(RefreshProperties.Repaint)]
[AttributeProvider(typeof(IListSource))]
public object DataSource
{
get => _dataGridView1.DataSource;
set => _dataGridView1.DataSource = value;
}
<Category("Data"), _
Description("Indicates the source of data for the control."), _
RefreshProperties(RefreshProperties.Repaint), _
AttributeProvider(GetType(IListSource))> _
Public Property DataSource() As Object
Get
Return Me.dataGridView1.DataSource
End Get
Set(ByVal value As Object)
Me.dataGridView1.DataSource = value
End Set
End Property
另请参阅
适用于
AttributeProviderAttribute(String, String)
使用给定的类型名称和属性名称初始化类的新实例 AttributeProviderAttribute 。
public:
AttributeProviderAttribute(System::String ^ typeName, System::String ^ propertyName);
public AttributeProviderAttribute(string typeName, string propertyName);
new System.ComponentModel.AttributeProviderAttribute : string * string -> System.ComponentModel.AttributeProviderAttribute
Public Sub New (typeName As String, propertyName As String)
参数
- typeName
- String
要指定的类型的名称。
- propertyName
- String
将为其检索属性的属性的名称。
例外
propertyName 是 null。