Adding extension methods to IServiceCollection in ASP.NET Core
Instead of doing 

services.AddThemes(options =&gt; {
    options = Configuration.GetSection("Themes").Get&lt;ThemesOptions&gt;();
});


you could  use

services.AddThemes(options =&gt; {
    Configuration.GetSection("Themes").Bind(options);
});


which will programatically set each value of options based on what's in the configuration.