TypeDescriptor.AddAttributes 方法

定義

將類別層級屬性加入目標元件。

多載

AddAttributes(Object, Attribute[])

將類別層級屬性加入目標元件執行個體。

AddAttributes(Type, Attribute[])

將類別層級屬性加入目標元件類型。

AddAttributes(Object, Attribute[])

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

將類別層級屬性加入目標元件執行個體。

public:
 static System::ComponentModel::TypeDescriptionProvider ^ AddAttributes(System::Object ^ instance, ... cli::array <Attribute ^> ^ attributes);
public static System.ComponentModel.TypeDescriptionProvider AddAttributes (object instance, params Attribute[] attributes);
static member AddAttributes : obj * Attribute[] -> System.ComponentModel.TypeDescriptionProvider
Public Shared Function AddAttributes (instance As Object, ParamArray attributes As Attribute()) As TypeDescriptionProvider

參數

instance
Object

目標元件的執行個體。

attributes
Attribute[]

要加入元件類別的 Attribute 物件陣列。

傳回

之前用以加入指定屬性之新建立的 TypeDescriptionProvider

例外狀況

其中一個參數或兩者皆為 null

備註

方法會將 AddAttributes(Object, Attribute[]) 類別層級屬性新增至元件的指定實例。 由於這是使用 Visual Studio Windows Forms Designer 和 屬性視窗 之應用程式的常見需求,因此此方法會建立類型描述提供者,將所提供的屬性與已存在於 類別上的屬性合併,以提供快捷方式。 傳回值是用來新增屬性的類型描述提供者。 稍後,當不再需要新增的屬性時,這個提供者可以傳遞至 RemoveProvider(TypeDescriptionProvider, Object) 方法。

另請參閱

適用於

AddAttributes(Type, Attribute[])

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

將類別層級屬性加入目標元件類型。

public:
 static System::ComponentModel::TypeDescriptionProvider ^ AddAttributes(Type ^ type, ... cli::array <Attribute ^> ^ attributes);
public static System.ComponentModel.TypeDescriptionProvider AddAttributes (Type type, params Attribute[] attributes);
static member AddAttributes : Type * Attribute[] -> System.ComponentModel.TypeDescriptionProvider
Public Shared Function AddAttributes (type As Type, ParamArray attributes As Attribute()) As TypeDescriptionProvider

參數

type
Type

目標元件的 Type

attributes
Attribute[]

要加入元件類別的 Attribute 物件陣列。

傳回

之前用以加入指定屬性之新建立的 TypeDescriptionProvider

例外狀況

其中一個參數或兩者皆為 null

備註

方法會將 AddAttributes(Type, Attribute[]) 類別層級屬性新增至元件的指定型別。 由於這是使用 Visual Studio Windows Forms Designer 和 屬性視窗 之應用程式的常見需求,因此此方法會建立類型描述提供者,將所提供的屬性與已存在於 類別上的屬性合併,以提供快捷方式。 傳回值是用來新增屬性的類型描述提供者。 稍後,當不再需要新增的屬性時,這個提供者可以傳遞至 RemoveProvider(TypeDescriptionProvider, Type) 方法。

另請參閱

適用於