<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0-preview3.19128.7" />

KeyValueConfigurationElement

Represents a configuration element that contains a key/value pair.
namespace System.Configuration { public class KeyValueConfigurationElement : ConfigurationElement { private static readonly ConfigurationPropertyCollection s_properties; private static readonly ConfigurationProperty s_propKey; private static readonly ConfigurationProperty s_propValue; private readonly string _initKey; private readonly string _initValue; private bool _needsInit; protected internal override ConfigurationPropertyCollection Properties => s_properties; [ConfigurationProperty("key", Options = ConfigurationPropertyOptions.IsKey, DefaultValue = "")] public string Key { get { return (string)base[s_propKey]; } } [ConfigurationProperty("value", DefaultValue = "")] public string Value { get { return (string)base[s_propValue]; } set { base[s_propValue] = value; } } static KeyValueConfigurationElement() { s_propKey = new ConfigurationProperty("key", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); s_propValue = new ConfigurationProperty("value", typeof(string), string.Empty, ConfigurationPropertyOptions.None); s_properties = new ConfigurationPropertyCollection { s_propKey, s_propValue }; } internal KeyValueConfigurationElement() { } public KeyValueConfigurationElement(string key, string value) { _needsInit = true; _initKey = key; _initValue = value; } protected internal override void Init() { base.Init(); if (_needsInit) { _needsInit = false; base[s_propKey] = _initKey; Value = _initValue; } } } }