C# - How to read custom configurations from appsettings.json

PHOTO EMBED

Wed Apr 20 2022 19:00:40 GMT+0000 (Coordinated Universal Time)

Saved by @iamsingularity

public class Startup
{
	public void ConfigureServices(IServiceCollection services)
	{
		services.AddControllers();

		var section = Configuration.GetSection(nameof(WeatherClientConfig));
		var weatherClientConfig = section.Get<WeatherClientConfig>();

		services.AddSingleton(weatherClientConfig);
	}
//The rest of Startup class	
}
content_copyCOPY

https://makolyte.com/csharp-how-to-read-custom-configuration-from-appsettings-json/