TypeDescriptor.AddAttributes Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds class-level attributes to the target component.
AddAttributes(Object, Attribute[]) |
Adds class-level attributes to the target component instance. |
AddAttributes(Type, Attribute[]) |
Adds class-level attributes to the target component type. |
- 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.
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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- 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
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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: