In appsettings.json
{
\"MyArray\": [
\"str1\",
\"str2\",
\"str3\"
]
}
In Startup.cs
If you want to pick value of first item then you should do like this-
var item0 = _config.GetSection("MyArray:0");
If you want to pick value of entire array then you should do like this-
IConfigurationSection myArraySection = _config.GetSection("MyArray");
var itemArray = myArraySection.AsEnumerable();
Ideally, you should consider using options pattern suggested by official documentation. This will give you more benefits.