ConfigurationElement.Attributes Property

Definition

Gets a configuration attribute collection that contains the list of attributes for this element.

public:
 property Microsoft::Web::Administration::ConfigurationAttributeCollection ^ Attributes { Microsoft::Web::Administration::ConfigurationAttributeCollection ^ get(); };
public Microsoft.Web.Administration.ConfigurationAttributeCollection Attributes { get; }
member this.Attributes : Microsoft.Web.Administration.ConfigurationAttributeCollection
Public ReadOnly Property Attributes As ConfigurationAttributeCollection

Property Value

A ConfigurationAttributeCollection object that contains the list of attributes for this element.

Examples

The following example obtains the Attributes property value, which is a collection of configuration element attributes. If the name attribute has a value of "TestDemo", the element is removed from the element collection. This code example is part of a larger example provided for the ConfigurationElement class.

ConfigurationElementCollection elementCollection = 
    moduleProvidersSection.GetCollection();
// If there is a configuration element with the name of TestDemo(Modified), delete it.
ConfigurationElement elementtoremove = null;
foreach (ConfigurationElement moduleproviderelement in elementCollection)
{
    if(moduleproviderelement.Attributes["name"].Value.ToString() == "TestDemo(Modified)")
    {
        elementtoremove = moduleproviderelement;
    }
}
if (elementtoremove != null)
{
    elementCollection.Remove(elementtoremove);
}

Remarks

You can use the returned ConfigurationAttributeCollection object to modify an attribute value.

Applies to