Getting config element from ConfigurationElementCollection

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-05-06T19:47:14Z Indexed on 2010/05/07 9:48 UTC
Read the original article Hit count: 366

I have (hopefully) setup ConfigurationElementCollection of my own design with emails as keys. Now what? Hard to find actually on the web. How do I:

  1. iterate through it?

  2. See if a specific element exists?

  3. get a specific element?

...given:

    YourConfigElement config = 
   ConfigurationManager.GetSection("YourSectionName") as YourConfigElement ;

Partial answer

  1. Does this work? no, sadly.

    foreach (X x in config.XCollection.AsQueryable()) ...

© Stack Overflow or respective owner

Related posts about c#

Related posts about system.configuration