Redigera

Dela via


TypeDescriptor.AddAttributes Method

Definition

Adds class-level attributes to the target component.

Overloads

AddAttributes(Object, Attribute[])

Adds class-level attributes to the target component instance.

AddAttributes(Type, Attribute[])

Adds class-level attributes to the target component type.

AddAttributes(Object, Attribute[])

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Adds class-level attributes to the target component instance.

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

Parameters

instance
Object

An instance of the target component.

attributes
Attribute[]

An array of Attribute objects to add to the component's class.

Returns

The newly created TypeDescriptionProvider that was used to add the specified attributes.

Exceptions

One or both of the parameters is null.

Remarks

The AddAttributes(Object, Attribute[]) method adds class-level attributes to the specified instance of a component. Because this is a common requirement of applications using the Visual Studio Windows Forms Designer and Properties window, this method provides a shortcut by creating a type description provider that merges the provided attributes with the attributes that already exist on the class. The return value is the type description provider that was used to add the attributes. This provider can later be passed to the RemoveProvider(TypeDescriptionProvider, Object) method when the added attributes are no longer needed.

See also

Applies to

AddAttributes(Type, Attribute[])

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Adds class-level attributes to the target component type.

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

Parameters

type
Type

The Type of the target component.

attributes
Attribute[]

An array of Attribute objects to add to the component's class.

Returns

The newly created TypeDescriptionProvider that was used to add the specified attributes.

Exceptions

One or both of the parameters is null.

Remarks

The AddAttributes(Type, Attribute[]) method adds class-level attributes to the specified type of a component. Because this is a common requirement of applications using the Visual Studio Windows Forms Designer and Properties window, this method provides a shortcut by creating a type description provider that merges the provided attributes with the attributes that already exist on the class. The return value is the type description provider that was used to add the attributes. This provider can later be passed to the RemoveProvider(TypeDescriptionProvider, Type) method when the added attributes are no longer needed.

See also

Applies to