Basic configuration reading and type conversion examples.
using Apq.Cfg;
var cfg = new CfgBuilder()
.AddJson("config.json", level: 0, writeable: false)
.Build();
// String value
var name = cfg.Get("App:Name");
// Integer value
var port = cfg.Get<int>("App:Port");
// Boolean value
var debug = cfg.Get<bool>("App:Debug");
// With default value
var timeout = cfg.Get<int?>("App:Timeout") ?? 30;
var dbSection = cfg.GetSection("Database");
var host = dbSection.Get("Host");
var port = dbSection.Get<int>("Port");
var name = dbSection.Get("Name");
Console.WriteLine($"Database: {host}:{port}/{name}");
if (cfg.Exists("App:OptionalFeature"))
{
var feature = cfg.Get("App:OptionalFeature");
// Use feature
}