ConfigurationRoot Class

The root node for a configuration.

Namespace
Microsoft.Extensions.Configuration
Assemblies
  • Microsoft.Extensions.Configuration

Syntax

public class ConfigurationRoot : IConfigurationRoot, IConfiguration
class Microsoft.Extensions.Configuration.ConfigurationRoot

Constructors

ConfigurationRoot(System.Collections.Generic.IList<Microsoft.Extensions.Configuration.IConfigurationProvider>)

Initializes a Configuration root with a list of providers.

Arguments:providers (System.Collections.Generic.IList<Microsoft.Extensions.Configuration.IConfigurationProvider>) – The Microsoft.Extensions.Configuration.IConfigurationProviders for this configuration.
public ConfigurationRoot(IList<IConfigurationProvider> providers)

Methods

GetChildren()

Gets the immediate children sub-sections.

Return type:System.Collections.Generic.IEnumerable<Microsoft.Extensions.Configuration.IConfigurationSection>
public IEnumerable<IConfigurationSection> GetChildren()
GetReloadToken()

Returns a Microsoft.Extensions.Primitives.IChangeToken that can be used to observe when this configuration is reloaded.

Return type:Microsoft.Extensions.Primitives.IChangeToken
public IChangeToken GetReloadToken()
GetSection(System.String)

Gets a configuration sub-section with the specified key.

Arguments:key (System.String) – The key of the configuration section.
Return type:Microsoft.Extensions.Configuration.IConfigurationSection
Returns:The Microsoft.Extensions.Configuration.IConfigurationSection.
public IConfigurationSection GetSection(string key)
Reload()

Force the configuration values to be reloaded from the underlying sources.

public void Reload()

Properties

Microsoft.Extensions.Configuration.ConfigurationRoot.Item[System.String]

Gets or sets the value corresponding to a configuration key.

Arguments:key (System.String) – The configuration key.
Return type:System.String
Returns:The configuration value.
public string this[string key] { get; set; }