Answers for "Load All Configuration Options in .Net Core"

C#
0

Load All Configuration Options in .Net Core

public class Index2Model : PageModel
{
    private IConfigurationRoot ConfigRoot;

    public Index2Model(IConfiguration configRoot)
    {
        ConfigRoot = (IConfigurationRoot)configRoot;
    }

    public ContentResult OnGet()
    {           
        string str = "";
        foreach (var provider in ConfigRoot.Providers.ToList())
        {
            str += provider.ToString() + "\n";
        }

        return Content(str);
    }
}
Posted by: Guest on September-10-2021

C# Answers by Framework

Browse Popular Code Answers by Language