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
I use naming convention of the keys and it works like a charm
var section1 = ConfigurationManager.GetSection("section1") as NameValueCollection;
for (int i = 0; i < section1.AllKeys.Length; i++)
{
//if you define the key is unique then use == operator
if (section1.AllKeys[i] == "keyName1")
{
// process keyName1
}
// if you define the key as a list, starting with the same name, then use string StartWith function
if (section1.AllKeys[i].Startwith("keyName2"))
{
// AllKeys start with keyName2 will be processed here
}
}