ConfigurationExtensions.GetRequiredSection(IConfiguration, String) Method

Definition

Gets a configuration subsection with the specified key.

C#
public static Microsoft.Extensions.Configuration.IConfigurationSection GetRequiredSection(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key);

Parameters

configuration
IConfiguration

The configuration to enumerate.

key
String

The key of the configuration section.

Returns

The IConfigurationSection.

Exceptions

There is no section with key key.

Remarks

If no matching sub-section is found with the specified key, an exception is raised.

Applies to

Proizvod Verzije
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)