0

I want to implement the following configuration section:

<Services>
  <Service name="Service-1" provider="Provider-1" type="Type-1">
    <add key="Region" value="region-name-1"/>
    <add key="AccessKey" value="1234567890"/>
    <add key="SecretKey" value="asdfghhkl"/>
  </Service>
  <Service name="Service-2" provider="Provider-1" type="Type-2">
    <add key="Region" value="region-name-2"/>
    <add key="EndpointName" value="tyudfv.endpoint.com"/>
    <add key="AccessKey" value="1234567890"/>
    <add key="SecretKey" value="asdfghhkl"/>
  </Service>
</Services>

And I'm struggling with two issues: 1. Retrieve list of nodes without wrapping with some parent ConfigurationSection 2. Retrieve KeyValue collection of node Is there some obvious way here? Or it's just such complicated as I think?

Oxana N
  • 11
  • 3
  • what xml parser are you even using? – Patrick Beynio Mar 11 '20 at 16:29
  • Does this answer your question? [How do I read and parse an XML file in C#?](https://stackoverflow.com/questions/642293/how-do-i-read-and-parse-an-xml-file-in-c) – Ian Mar 11 '20 at 16:32
  • Also take a look at this: https://support.microsoft.com/en-us/help/815786/how-to-store-and-retrieve-custom-information-from-an-application-confi – vasilisdmr Mar 11 '20 at 16:32
  • I want to ready this section from web.config with custom class, as I wrote. So I appreciate if someone can explain me how to do this. And If it's even possible without any complications (like read XML directly or something like this) – Oxana N Mar 11 '20 at 16:44

0 Answers0