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.AttributeProviderAttributePublic 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.AttributeProviderAttributePublic Sub New (type As Type)参数
- type
- Type
要指定的类型。
例外
              type 为 null。
示例
下面的代码示例演示如何使用 AttributeProviderAttribute 标记 DataSource 具有特定类型的 IListSource属性。 有关完整代码列表,请参阅如何:在Windows 窗体控件中应用属性。
[Category("Data")]
[Description("Indicates the source of data for the control.")]
[RefreshProperties(RefreshProperties.Repaint)]
[AttributeProvider(typeof(IListSource))]
public object DataSource
{
    get
    {
        return this.dataGridView1.DataSource;
    }
    set
    {
        this.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.AttributeProviderAttributePublic Sub New (typeName As String, propertyName As String)参数
- typeName
- String
要指定的类型的名称。
- propertyName
- String
将为其检索特性的属性的名称。
例外
              propertyName 为 null。