Microsoft.Extensions.Configuration.Binder 8.0.0-preview.2.23128.3

About

Provides the functionality to bind an object to data in configuration providers for Microsoft.Extensions.Configuration. This package enables you to represent the configuration data as strongly-typed classes defined in the application code. To bind a configuration, use the Microsoft.Extensions.Configuration.ConfigurationBinder.Get extension method on the IConfiguration object. To use this package, you also need to install a package for the configuration provider, for example, Microsoft.Extensions.Configuration.Json for the JSON provider.

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

Example

The following example shows how to bind a JSON configuration section to .NET objects.

using System;
using Microsoft.Extensions.Configuration;

class Settings
{
    public string Server { get; set; }
    public string Database { get; set; }
    public Endpoint[] Endpoints { get; set; }
}

class Endpoint
{
    public string IPAddress { get; set; }
    public int Port { get; set; }
}

class Program
{
    static void Main()
    {
        // Build a configuration object from JSON file
        IConfiguration config = new ConfigurationBuilder()
            .AddJsonFile("appsettings.json")
            .Build();

        // Bind a configuration section to an instance of Settings class
        Settings settings = config.GetSection("Settings").Get<Settings>();

        // Read simple values
        Console.WriteLine($"Server: {settings.Server}");
        Console.WriteLine($"Database: {settings.Database}");

        // Read nested objects
        Console.WriteLine("Endpoints: ");
        
        foreach (Endpoint endpoint in settings.Endpoints)
        {
            Console.WriteLine($"{endpoint.IPAddress}:{endpoint.Port}");
        }
    }
}

To run this example, include an appsettings.json file with the following content in your project:

{
  "Settings": {
    "Server": "example.com",
    "Database": "Northwind",
    "Endpoints": [
      {
        "IPAddress": "192.168.0.1",
        "Port": "80"
      },
      {
        "IPAddress": "192.168.10.1",
        "Port": "8080"
      }
    ]
  }
}

You can include a configuration file using a code like this in your .csproj file:

<ItemGroup>
  <Content Include="appsettings.json">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content>
</ItemGroup>

Showing the top 20 packages that depend on Microsoft.Extensions.Configuration.Binder.

Packages Downloads
Microsoft.Extensions.Logging.Configuration
Configuration support for Microsoft.Extensions.Logging.
3,946
Microsoft.Extensions.Options.ConfigurationExtensions
Provides additional configuration specific functionality related to Options.
3,944
Serilog.Settings.Configuration
Microsoft.Extensions.Configuration (appsettings.json) support for Serilog.
3,930
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
1,449
Microsoft.Extensions.Logging.Configuration
Configuration support for Microsoft.Extensions.Logging.
1,440
Microsoft.Extensions.Options.ConfigurationExtensions
Provides additional configuration specific functionality related to Options.
1,432
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
1,419
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
1,419
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
498
Serilog.Settings.Configuration
Microsoft.Extensions.Configuration (appsettings.json) support for Serilog.
496
Microsoft.Extensions.Options.ConfigurationExtensions
Provides additional configuration specific functionality related to Options.
494
Microsoft.Extensions.OptionsModel
Provides a strongly typed way of specifying and accessing settings using dependency injection.
72
Microsoft.AspNetCore.Server.Kestrel.Core
Core components of ASP.NET Core Kestrel cross-platform web server.
58
Sentry.AspNetCore
Official ASP.NET Core integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
56
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
55
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
55
Microsoft.AspNetCore.Components.WebAssembly
Build client-side single-page applications (SPAs) with Blazor running under WebAssembly. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/36f34b3a19eb7219142ab2035921d08e84c572c3
55
Microsoft.Extensions.Azure
Azure Client SDK integration with Microsoft.Extensions libraries
54
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
52
Microsoft.AspNetCore.Components.WebAssembly
Build client-side single-page applications (SPAs) with Blazor running under WebAssembly. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/d47e49e9c1e173ac90821f7e89cc38e710274241
52

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET 6.0

.NET 7.0

.NET 8.0

.NET Standard 2.0

Version Downloads Last updated
10.0.0-preview.3.25171.5 5 04/11/2025
10.0.0-preview.2.25163.2 7 03/26/2025
10.0.0-preview.1.25080.5 9 02/26/2025
9.0.4 6 04/12/2025
9.0.3 8 03/12/2025
9.0.2 8 02/12/2025
9.0.1 10 01/22/2025
9.0.0 22 11/13/2024
9.0.0-rc.2.24473.5 16 10/12/2024
9.0.0-rc.1.24431.7 23 09/16/2024
9.0.0-preview.7.24405.7 21 08/13/2024
9.0.0-preview.6.24327.7 28 07/10/2024
9.0.0-preview.5.24306.7 26 06/11/2024
9.0.0-preview.4.24266.19 23 05/26/2024
9.0.0-preview.3.24172.9 28 04/12/2024
9.0.0-preview.2.24128.5 33 03/14/2024
9.0.0-preview.1.24080.9 28 02/23/2024
8.0.2 2,039 07/10/2024
8.0.1 1,954 01/17/2024
8.0.0 3,947 11/17/2023
8.0.0-rc.2.23479.6 41 10/10/2023
8.0.0-rc.1.23419.4 49 09/14/2023
8.0.0-preview.7.23375.6 39 08/30/2023
8.0.0-preview.6.23329.7 43 07/11/2023
8.0.0-preview.5.23280.8 47 06/28/2023
8.0.0-preview.4.23259.5 48 05/20/2023
8.0.0-preview.3.23174.8 41 04/30/2023
8.0.0-preview.2.23128.3 47 04/30/2023
8.0.0-preview.1.23110.8 45 02/22/2023
7.0.4 501 04/30/2023
7.0.3 50 05/14/2023
7.0.2 57 01/24/2023
7.0.1 60 12/27/2022
7.0.0 508 12/07/2022
7.0.0-rc.2.22472.3 51 06/28/2023
7.0.0-rc.1.22426.10 57 10/26/2022
7.0.0-preview.7.22375.6 47 10/30/2022
7.0.0-preview.6.22324.4 43 10/16/2022
7.0.0-preview.5.22301.12 47 06/27/2023
7.0.0-preview.4.22229.4 38 06/30/2023
7.0.0-preview.3.22175.4 39 07/04/2023
7.0.0-preview.2.22152.2 50 06/29/2023
7.0.0-preview.1.22076.8 38 06/29/2023
6.0.2-mauipre.1.22102.15 62 05/27/2022
6.0.2-mauipre.1.22054.8 41 06/29/2023
6.0.1 15 11/13/2024
6.0.0 1,445 12/07/2021
6.0.0-rc.2.21480.5 48 06/26/2023
6.0.0-rc.1.21451.13 41 06/28/2023
6.0.0-preview.7.21377.19 49 05/27/2022
6.0.0-preview.6.21352.12 45 07/02/2023
6.0.0-preview.5.21301.5 42 06/29/2023
6.0.0-preview.4.21253.7 34 06/29/2023
6.0.0-preview.3.21201.4 45 05/27/2022
6.0.0-preview.2.21154.6 43 05/27/2022
6.0.0-preview.1.21102.12 54 08/10/2022
5.0.0 59 05/26/2022
5.0.0-rc.2.20475.5 39 06/16/2023
5.0.0-rc.1.20451.14 52 12/02/2022
5.0.0-preview.8.20407.11 38 07/02/2023
5.0.0-preview.7.20364.11 44 05/27/2022
5.0.0-preview.6.20305.6 49 06/28/2023
5.0.0-preview.5.20278.1 38 05/27/2022
5.0.0-preview.4.20251.6 40 05/27/2022
5.0.0-preview.3.20215.2 48 05/27/2022
5.0.0-preview.2.20160.3 43 06/30/2023
5.0.0-preview.1.20120.4 48 05/27/2022
3.1.32 37 05/05/2023
3.1.31 38 05/10/2023
3.1.30 46 04/22/2023
3.1.29 43 04/21/2023
3.1.28 38 05/02/2023
3.1.27 57 11/27/2022
3.1.26 41 03/21/2023
3.1.25 44 05/28/2022
3.1.24 40 05/27/2022
3.1.23 44 03/15/2023
3.1.22 40 03/22/2023
3.1.21 42 05/28/2022
3.1.20 42 03/22/2023
3.1.19 40 05/17/2023
3.1.18 39 11/04/2022
3.1.17 37 04/19/2023
3.1.16 49 11/02/2022
3.1.15 63 05/27/2022
3.1.14 36 03/30/2023
3.1.13 45 04/10/2023
3.1.12 42 09/24/2022
3.1.11 43 06/11/2022
3.1.10 35 02/19/2023
3.1.9 43 03/28/2023
3.1.8 48 05/27/2022
3.1.7 42 11/09/2020
3.1.6 44 05/22/2023
3.1.5 58 03/31/2023
3.1.4 41 04/09/2023
3.1.3 53 02/25/2023
3.1.2 51 05/27/2022
3.1.1 56 06/30/2023
3.1.0 504 07/11/2022
3.1.0-preview3.19553.2 43 05/27/2022
3.1.0-preview2.19525.4 43 05/27/2022
3.1.0-preview1.19506.1 42 06/27/2023
3.0.3 50 06/07/2023
3.0.2 43 05/27/2022
3.0.1 50 05/03/2023
3.0.0 42 12/31/2022
3.0.0-rc1.19456.10 54 05/27/2022
3.0.0-preview9.19423.4 43 05/27/2022
3.0.0-preview8.19405.4 52 06/30/2023
3.0.0-preview7.19362.4 49 04/11/2023
3.0.0-preview6.19304.6 43 10/23/2022
3.0.0-preview5.19227.9 45 11/08/2022
3.0.0-preview4.19216.2 56 05/28/2022
3.0.0-preview3.19153.1 44 05/27/2022
3.0.0-preview.19074.2 44 06/27/2023
3.0.0-preview.18572.1 40 05/27/2022
2.2.4 48 05/27/2022
2.2.0 65 09/21/2022
2.2.0-preview3-35497 46 04/10/2023
2.2.0-preview2-35157 57 05/27/2022
2.2.0-preview1-35029 33 05/27/2022
2.1.10 44 08/24/2022
2.1.1 1,416 05/27/2022
2.1.0 48 05/27/2022
2.1.0-rc1-final 54 05/27/2022
2.1.0-preview2-final 49 10/29/2022
2.1.0-preview1-final 51 05/27/2022
2.0.2 42 05/27/2022
2.0.1 46 11/25/2022
2.0.0 44 06/07/2022
2.0.0-preview2-final 44 04/05/2023
2.0.0-preview1-final 50 03/29/2023
1.1.2 58 11/12/2022
1.1.1 58 12/13/2021
1.1.0 42 04/20/2023
1.1.0-preview1-final 56 05/27/2022
1.0.2 43 12/24/2021
1.0.1 39 11/15/2022
1.0.0 37 06/26/2023
1.0.0-rc2-final 53 11/27/2022
1.0.0-rc1-final 46 05/27/2022