Skip to main content
.NETFramework4.6.2net6.0net7.0net8.0.NETStandard2.0

Provides abstractions of key-value pair based configuration. Interfaces defined in this package are implemented by classes in Microsoft.Extensions.Configuration and other configuration packages.

Published
Jun 13, 2023
3y ago
Total Downloads
9.7B
9,697,212,615

Install

dotnet add package Microsoft.Extensions.Configuration.Abstractions --version 8.0.0-preview.5.23280.8
ProductVersions
.NET
net6.0net7.0net8.0
.NET Standard
netstandard2.0
Other
.NETFramework4.6.2

README

About

Provides abstractions of key-value pair based configuration. Interfaces defined in this package are implemented by classes in Microsoft.Extensions.Configuration and other configuration packages.

Commonly used types:

For more information, see the documentation: Configuration in .NET.

Example

The example below shows a small code sample using this library and trying out the ConfigurationKeyName attribute available since .NET 6:

public class MyClass
{
    [ConfigurationKeyName("named_property")]
    public string NamedProperty { get; set; }
}

Given the simple class above, we can create a dictionary to hold the configuration data and use it as the memory source to build a configuration section:

var dic = new Dictionary<string, string>
{
    {"named_property", "value for named property"},
};

var config = new ConfigurationBuilder()
    .AddInMemoryCollection(dic)
    .Build();

var options = config.Get<MyClass>();
Console.WriteLine(options.NamedProperty); // returns "value for named property"

Changes from Previous Version

No structural changes between v8.0.0-preview.4.23259.5 and v8.0.0-preview.5.23280.8.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 5 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.