AttributeProviderAttribute 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 AttributeProviderAttribute 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| 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。