The Microsoft documentation states that
App settings can be read from environment variables both when developing locally and when running in Azure. When developing locally, app settings come from the Values collection in the local.settings.json file. In both environments, local and Azure, GetEnvironmentVariable("") retrieves the value of the named app setting. For instance, when you're running locally, "My Site Name" would be returned if your local.settings.json file contains { "Values": { "WEBSITE_SITE_NAME": "My Site Name" } }.
The System.Configuration.ConfigurationManager.AppSettings property is an alternative API for getting app setting values, but we recommend that you use GetEnvironmentVariable as shown here.
It is not stated why it is the recommended way.
- Does it have performance advantages?
- Is there is an instance where reading from AppSettings would result in an empty value?
- Is it just for compatibility with different configuration formats (i.e., json, xml, etc)?
Or do I just accept this as a fact of life without knowing why?