Created
April 19, 2021 11:18
-
-
Save manoj-choudhari-git/52767b3e3ff651ad0b471a528d9ab41d to your computer and use it in GitHub Desktop.
Read configuration settings from IConfiguration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
private readonly ILogger<HomeController> _logger; | |
private readonly IConfiguration configuration; | |
public HomeController(ILogger<HomeController> logger, IConfiguration configuration) | |
{ | |
_logger = logger; | |
this.configuration = configuration; | |
} | |
public IActionResult Index() | |
{ | |
var mode = configuration["Mode"]; | |
var defaultLogLevel = configuration["Logging:LogLevel:Default"]; | |
var firstSubjectFromArray = configuration["MailFeature:0:Subject"]; | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment