Mid From PDF ASP.NET Core ASP.NET Core

Using IConfiguration to read settings?

Inject IConfiguration anywhere:

public class MyService {
private readonly string _apiKey;
public MyService(IConfiguration config) {
_apiKey = config["MySettings:ApiKey"];
}
}

You can also access nested settings via config.GetSection("MySettings").

More from ASP.NET Core Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details