API Overview
This section provides the complete API reference for Apq.Cfg.
Core Interfaces
| Interface | Description |
|---|---|
| ICfgRoot | Configuration root interface, main entry point |
| ICfgSection | Configuration section interface |
Core Classes
| Class | Description |
|---|---|
| CfgBuilder | Fluent API builder for creating configuration |
Extension Methods
| Category | Description |
|---|---|
| Extensions | Extension methods for various configuration sources |
Quick Reference
Creating Configuration
csharp
using Apq.Cfg;
var cfg = new CfgBuilder()
.AddJsonFile("config.json", level: 0, writeable: false)
.Build();Reading Values
csharp
// String value
string? value = cfg["App:Name"];
// Typed value
int port = cfg.GetValue<int>("App:Port");
// Check existence
bool exists = cfg.Exists("App:Name");
// Get section
ICfgSection section = cfg.GetSection("Database");Writing Values
csharp
// Set value
cfg.SetValue("App:Name", "NewName");
// Remove value
cfg.Remove("App:TempKey");
// Save changes
await cfg.SaveAsync();Batch Operations
csharp
// Read multiple
var values = cfg.GetMany(new[] { "Key1", "Key2", "Key3" });
// Write multiple
cfg.SetManyValues(new Dictionary<string, string?>
{
["Key1"] = "Value1",
["Key2"] = "Value2"
});Configuration Changes
csharp
cfg.ConfigChanges.Subscribe(e =>
{
foreach (var (key, change) in e.Changes)
{
Console.WriteLine($"[{change.Type}] {key}");
}
});Next Steps
- CfgBuilder - Builder API reference
- ICfgRoot - Root interface reference
- ICfgSection - Section interface reference