KeyValueConfigurationElement.Key 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 KeyValueConfigurationElement 对象的键。
public:
 property System::String ^ Key { System::String ^ get(); };[System.Configuration.ConfigurationProperty("key", DefaultValue="", Options=System.Configuration.ConfigurationPropertyOptions.IsKey)]
public string Key { get; }public string Key { get; }[<System.Configuration.ConfigurationProperty("key", DefaultValue="", Options=System.Configuration.ConfigurationPropertyOptions.IsKey)>]
member this.Key : stringmember this.Key : stringPublic ReadOnly Property Key As String属性值
KeyValueConfigurationElement 的键。
- 属性
示例
下面的代码示例演示如何使用 Key 属性。 此代码示例是为类概述提供的更大示例的 KeyValueConfigurationCollection 一部分。
// 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