System.ComponentModel.AttributeCollection Class

Represents a collection of attributes.

See Also: AttributeCollection Members

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public class AttributeCollection : ICollection

Remarks

The System.ComponentModel.AttributeCollection class is read-only; it does not implement methods to add or remove attributes. You must inherit from this class to implement these methods.

Use the AttributeCollection.Count property to find the number of attributes that exist in the collection.

You can also use the methods of this class to query the collection about its contents. Call the AttributeCollection.Contains(Attribute) method to verify that a specified attribute or attribute array exists in the collection. Call the AttributeCollection.Matches(Attribute) method to verify that a specified attribute or array of attributes exists in the collection, and that the values of the specified attributes are the same as the values in the collection.

While most attributes have default values, default values are not required. If an attribute has no default value, null is returned from the indexed property that takes a type. When defining your own attributes, you can declare a default value by either providing a constructor that takes no arguments, or defining a public static field of your attribute type named "Default".

Requirements

Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0, 4.0.0.0