Hi,
Im just following this code example implementing WebAPIBaseURL

2. when i declaring these 3 variables i got an error

Pls help me and guide me where these variables comming from
Dependency Injection
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Amit MohantyRank #112 · 20K reputationPosted May 30, 2023, 4:58 AM EDT
You have to declare variables like this:
private readonly ILogger _logger; private readonly IConfiguration _configuration; private readonly string apiBaseUrl; public HomeController(ILogger logger, IConfiguration configuration) { _logger = logger; _configuration = configuration; apiBaseUrl = _configuration.GetSection("WebAPIBaseUrl").Value; }