I\'m trying to use ConfigurationManager.AppSettings.GetValues() to retrieve multiple configuration values for a single key, but I\'m always receiving an array o
My take on JJS's reply: Config file:
Code to retrieve into string[]
private void button1_Click(object sender, EventArgs e)
{
string[] output = CollectFromConfig("List1");
foreach (string key in output) label1.Text += key + Environment.NewLine;
label1.Text += Environment.NewLine;
output = CollectFromConfig("List2");
foreach (string key in output) label1.Text += key + Environment.NewLine;
}
private string[] CollectFromConfig(string key)
{
NameValueCollection keyCollection = (NameValueCollection)ConfigurationManager.GetSection(key);
return keyCollection.AllKeys;
}
IMO, that's as simple as it is going to get. Feel free to prove me wrong :)