[SOLVED] How do I get subsections of a IConfigurat...
# help-with-umbraco
t
I am using
IUmbracoBuilder
to do this:
var section = builder.Config.GetSection("PrepopulateUsers")
This returns an
IConfigurationSection
and I need to check its subsections as in the image (those 5 sub sections). How can I get info on those sections? The
IConfigurationSection
has no methods to get those sections from what I can see? https://cdn.discordapp.com/attachments/1220366835116019732/1220366835250368542/image.png?ex=660eae2e&is=65fc392e&hm=b63e8ec933d75b328d64bbea97e32aac900b8429e079b23fb9a0f08a56528aae&
My end goal is simply to in a startup component check a config with a prop that has an array of objects I want to operate on.
r
IConfigurationSection
should have its own
.GetSection
method, since it inherits from `IConfiguration`: https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.iconfigurationsection?view=dotnet-plat-ext-8.0#methods
h
just keep using getSection if they are nested config.GetSection("SnitzForums").GetSection("forumTablePrefix") etc
t
I had an issue with using arrays, but the key was using
GetChildren
and checking
Any
on it for existing element 👍
69 Views