KeyValueConfigurationElement.Key Eigenschap

Definitie

Hiermee haalt u de sleutel van het KeyValueConfigurationElement object op.

public:
 property System::String ^ Key { System::String ^ get(); };
[System.Configuration.ConfigurationProperty("key", DefaultValue="", Options=System.Configuration.ConfigurationPropertyOptions.IsKey)]
public string Key { get; }
[<System.Configuration.ConfigurationProperty("key", DefaultValue="", Options=System.Configuration.ConfigurationPropertyOptions.IsKey)>]
member this.Key : string
Public ReadOnly Property Key As String

Waarde van eigenschap

De sleutel van de KeyValueConfigurationElement.

Kenmerken

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u de Key eigenschap gebruikt. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor het KeyValueConfigurationCollection klasseoverzicht.

// Display each KeyValueConfigurationElement.
foreach (KeyValueConfigurationElement keyValueElement in settings)
{
  Console.WriteLine("Key: {0}", keyValueElement.Key);
  Console.WriteLine("Value: {0}", keyValueElement.Value);
  Console.WriteLine();
}
' Display each KeyValueConfigurationElement.
Dim keyValueElement As KeyValueConfigurationElement
For Each keyValueElement In settings
  Console.WriteLine("Key: {0}", keyValueElement.Key)
  Console.WriteLine("Value: {0}", keyValueElement.Value)
  Console.WriteLine()
Next

Van toepassing op