TypeDescriptor.AddAttributes Method (Object, Attribute[])

Adds class-level attributes to the target component instance.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

public static TypeDescriptionProvider AddAttributes (
	Object instance,
	params Attribute[] attributes
public static TypeDescriptionProvider AddAttributes (
	Object instance, 
	Attribute[] attributes
public static function AddAttributes (
	instance : Object, 
	... attributes : Attribute[]
) : TypeDescriptionProvider
Not applicable.



An instance of the target component.


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

Return Value

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

Exception typeCondition


One or both of the parameters is a null reference (Nothing in Visual Basic).

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 method when the added attributes are no longer needed.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions