ConfigurationAttribute.Name Property

Definition

Gets the name of the configuration attribute.

public:
 property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String

Property Value

String

The name of the configuration attribute.

Examples

The following example gets the value of the Name property for each of the configuration attributes. This code example is part of a larger example provided for the ConfigurationAttribute class.

// Get the attributes again, after the commit changes.
Configuration config2 = manager.GetApplicationHostConfiguration();
configSection = config2.GetSection("system.web/anonymousIdentification");
configAttributeCollection = configSection.Attributes;
Console.WriteLine("There are " +
    configAttributeCollection.Count.ToString() +
    " Configuration attributes.");
attribute = configAttributeCollection[1];
Console.WriteLine("metadata: " +
    attribute.GetMetadata("encryptionProvider"));
// Display each configuration attribute with properties and metadata.
foreach (ConfigurationAttribute configAttribute in configAttributeCollection)
{
    Console.WriteLine("\t{0}\t{1}\t{2}\t{3}",
         configAttribute.Name,
         configAttribute.Value,
         configAttribute.IsProtected,
         configAttribute.GetMetadata("encryptionProvider"));
}

Remarks

Attribute names must be unique within a configuration element.

Applies to