<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />

AppSettingsReader

public class AppSettingsReader
The AppSettingsReader class provides a wrapper for System.Configuration.ConfigurationManager.AppSettings which provides a single method for reading values from the config file of a particular type.

public object GetValue(string key, Type type)

Gets the value for specified key from ConfigurationManager.AppSettings, and returns an object of the specified type containing the value from the config file. If the key isn't in the config file, or if it is not a valid value for the given type, it will throw an exception with a descriptive message so the user can make the appropriate change