<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0-preview.4.23259.5" />

ConfigurationFileMap

Defines the configuration file mapping for the machine configuration file.
using System.Configuration.Provider; using System.IO; using System.Configuration.Provider; namespace System.Configuration { public class ConfigurationFileMap : ICloneable { private Func<string> _getFilenameThunk; public string MachineConfigFilename { get { return _getFilenameThunk(); } set { _getFilenameThunk = (() => value); } } internal bool IsMachinePathDefault => _getFilenameThunk == new Func<string>(GetFilenameFromMachineConfigFilePath); public ConfigurationFileMap() { _getFilenameThunk = GetFilenameFromMachineConfigFilePath; } public ConfigurationFileMap(string machineConfigFilename) { if (string.IsNullOrEmpty(machineConfigFilename)) throw new ArgumentNullException("machineConfigFilename"); if (!File.Exists(machineConfigFilename)) throw new ArgumentException(System.SR.Format(System.SR.Machine_config_file_not_found, machineConfigFilename), "machineConfigFilename"); MachineConfigFilename = machineConfigFilename; } private ConfigurationFileMap(ConfigurationFileMap other) { _getFilenameThunk = other._getFilenameThunk; } public virtual object Clone() { return new ConfigurationFileMap(this); } private static string GetFilenameFromMachineConfigFilePath() { return ClientConfigurationHost.MachineConfigFilePath; } } } namespace System.Configuration { public class ProtectedConfigurationProviderCollection : ProviderCollection { public new ProtectedConfigurationProvider this[string name] { get { return (ProtectedConfigurationProvider)base[name]; } } public override void Add(ProviderBase provider) { if (provider == null) throw new ArgumentNullException("provider"); if (!(provider is ProtectedConfigurationProvider)) throw new ArgumentException(System.SR.Format(System.SR.Config_provider_must_implement_type, typeof(ProtectedConfigurationProvider).ToString()), "provider"); base.Add(provider); } } }