ConfigurationElement.Attributes Eigenschaft

Definition

Ruft eine Konfigurationsattributeauflistung ab, die die Liste der Attribute für dieses Element enthält.

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

Eigenschaftswert

Ein ConfigurationAttributeCollection -Objekt, das die Liste der Attribute für dieses Element enthält.

Beispiele

Im folgenden Beispiel wird der Attributes -Eigenschaftswert abgerufen, bei dem es sich um eine Auflistung von Konfigurationselementattributen handelt. Wenn das name Attribut den Wert "TestDemo" aufweist, wird das Element aus der Elementauflistung entfernt. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die ConfigurationElement-Klasse bereitgestellt wird.

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

Hinweise

Sie können das zurückgegebene ConfigurationAttributeCollection Objekt verwenden, um einen Attributwert zu ändern.

Gilt für: