Getting Value from appsettings.json in .NET Core

PHOTO EMBED

Wed Apr 20 2022 18:52:27 GMT+0000 (Coordinated Universal Time)

Saved by @iamsingularity #csharp

//AppSettings.cs
namespace FetchAppsettingsValue
{
    public class AppSettings
    {
        public Logging Logging { get; set; }
        public string AllowedHosts { get; set; }
    }

    public class Logging
    {
        public LogLevel LogLevel { get; set; }
    }

    public class LogLevel
    {
        public string Default { get; set; }

        public string Warning { get; set; }

        public string Error { get; set; }
    }
}
content_copyCOPY

https://www.telerik.com/blogs/how-to-get-values-from-appsettings-json-in-net-core