Jamie Brown
Accessing configuration inside CreateDefaultBuilder chain
In
you're trying to get a
string[]
, but in your appsettings.json
you just have it as a string value.
either you need to change what you're requesting to a string
, or if you're expecting multiple values, you need to reflect it as an array in json.
i.e.
8 replies
✅ Can't infer type arguments from usage
Actually this is one of the (all too common unfortunately) cases where I've made the problem more complex than it needs to be, you can just do:
And it will work without issue.
I had it in my mind that the compiler would struggle to infer the type of the inner collection, but just goes to show I need to have a little more faith!
10 replies