.NET core 3.X
no need to create new model and to set in Startup.cs.
Controller Add new package - using Microsoft.Extensions.Configuration;
public class HomeController : Controller
{
private readonly IConfiguration _mySettings;
public HomeController (IConfiguration mySettings)
{
_mySettings= mySettings;
}
//ex: you can get value on below function
public IEnumerable<string> Get()
{
var result = _config.GetValue<string>("AppSettings:Version"); // "One"
return new string[] { result.ToString() };
}
}