I have a string in appsettings.json:
{
"GeneralSettings": {
"CompanyIds": "1,2,3,4,5"
}
}
How can I map it to a class, I need split it into the list by comma:
public class GeneralSettings
{
public List<int> CompanyIds { get; set; }
}
Now I have:
var generalSettings = new GeneralSettings();
configuration.GetSection(nameof(GeneralSettings)).Bind(generalSettings);