Skip to content

Pact Web Extensions ServiceCollectionExtensions GetConfigurationSection T (Microsoft Extensions DependencyInjection IServiceCollection Microsoft Extensions Configuration IConfiguration string Microsoft Extensions Configuration IConfigurationSection)

welshronaldo edited this page May 30, 2022 · 4 revisions

ServiceCollectionExtensions.GetConfigurationSection<T>(IServiceCollection, IConfiguration, string, IConfigurationSection) Method

Retrieves a strongly-typed named section from the configuration, but also registers it with Configure internally.

public static T GetConfigurationSection<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration, string key, out Microsoft.Extensions.Configuration.IConfigurationSection section)
    where T : class;

Type parameters

T

Parameters

services Microsoft.Extensions.DependencyInjection.IServiceCollection
The service collection

configuration Microsoft.Extensions.Configuration.IConfiguration
The configuration

key System.String
The name of the configuration section to extract

section Microsoft.Extensions.Configuration.IConfigurationSection
Optional output of the configuration section itself (may be useful for binding)

Returns

T
A strongly-typed configuration object

Clone this wiki locally