Command line source
Location: main sources module.
CommandLineSource converts CLI arguments into settings nodes.
public static void Main(string[] args)
{
var source = new CommandLineSource(args);
}
It supports 7 syntax options for key-value parameters:
--key=value
--key value
-key=value
-key value
/key=value
/key value
key=value
Keys with dots (such as a.b.c
) are treated as hierarchical and get split into segments:
--throttling.capacity=50 --> { "throttling": { "capacity": "50" } }
Multiple occurrences of the same key are merged into arrays.
This source is static and never issues data updates.
Default keys and values
Standalone keys may optionally be supplied with a default value.
Standalone values may optionally be grouped under default key.
var source = new CommandLineSource(args, "main", "true");
--enable --> { "enable": "true" }
100 200 --> { "main": ["100", "200"] }
Related pages
Configuration sourcesLast updated
Was this helpful?