Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Key Property
Collapse the table of content
Expand the table of content

KeyValueConfigurationElement.Key Property

Gets the key of the KeyValueConfigurationElement object.

Namespace:  System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

[ConfigurationPropertyAttribute("key", Options = ConfigurationPropertyOptions.IsKey, DefaultValue = "")]
public string Key { get; }

Property Value

Type: System.String
The key of the KeyValueConfigurationElement.

The following code example demonstrates how to use the Key property. This code example is part of a larger example provided for the KeyValueConfigurationCollection class overview.

// Display each KeyValueConfigurationElement. 
foreach (KeyValueConfigurationElement keyValueElement in settings)
  Console.WriteLine("Key: {0}", keyValueElement.Key);
  Console.WriteLine("Value: {0}", keyValueElement.Value);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft