I am trying to create config that will contains a list of servers, with extra values, something like
"Servers": [
{
"Name": ".",
"Type": "A"
},
{
"Name": "Fred",
"Type": "B"
}
]
Is that the correct way to structure the config file?
I then haven't been able to find a way to read from the config based on the above set up.
var test = Configuration.GetSection("Servers").GetChildren();
//List<Server> Servers = new List<Server>();
foreach (var testItem in test)
{
Server server = new Server()
{
//Name = testItem.GetValue(,"Name"),
//Type = testItem.GetValue("Type")
};
Servers.Add(server);
}
I'd appreciate some guidance on how to set up the config, and then how to read those values.
Thanks for reading