I've searched the site and haven't found exactly what I'm looking for. Close, but no cigar.
Basically I want to have a config section like this:
<configSections>
<section name="PhoneNotificationsSection" type="Alerts.PhoneAlertConfigSection,Alerts,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"/>
</configSections>
<PhoneNotificationsSection>
<phones>
<add phone="MyMobile" value="
[email protected]" />
<add phone="OtherMobile" value="
[email protected]" />
</phones>
</PhoneNotificationsSection>
Then I'd like to, in my appSettings consuming code, be able to write something like this (pseudo code):
foreach (phone p in phones)
{
//'phone' attribute is just helpful/descriptive
DoSomething(p.value);
}
I've done enough research to know I probably need a few of my own classes that implement and/or inherit from certain Configuration classes to make the above code possible. I just haven't found anything that clearly demonstrates this scenario and how to code for it - and when I try to learn the whole .NET configuration world my brain starts to hurt. Anyone have some code like what I'm looking for that they can share?