Export (0) Print
Expand All

Attributes Property

IIS 7.0

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

Namespace:  Microsoft.Web.Administration
Assembly:  Microsoft.Web.Administration (in Microsoft.Web.Administration.dll)

public ConfigurationAttributeCollection Attributes { get; }

Property Value

Type: Microsoft.Web.Administration..::..ConfigurationAttributeCollection
A ConfigurationAttributeCollection object that contains the list of attributes for this element.

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

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);
}


Community Additions

ADD
Show:
© 2014 Microsoft