Is there a way for me to include a simple array of strings, or List<string> on my custom subclass of ConfigurationSection? (Or an array or generic list of simple data objects, for that matter?)
I’m becoming familiar with the new (and VERY verbose) ConfigurationSection, ConfigurationElement, and ConfigurationElementCollection classes, but I’m by no means an expert yet.
It seems like ConfigurationSection should handle simple collections/lists on its own, without me having to create a custom ConfigurationElementCollection subclass for each and every one. But I haven’t found any reference to this ability online.
Edit: accepting Dan’s response as the answer, since it’s probably the closest thing I’m going to get to the “old style” configSections. I always found it easy, flexible, and elegant that any XmlSerializable object could easily become a configSection. I’m sure the new framework is more powerful; however it’s sad that it is SO cumbersome for simple configuration contructs, that we’re reduced to going back to String.Split().
OK, you asked for simple. Well, the simplest way to store a series of strings would be to use a delimited list (say, comma separated). That way you can store it in just one element (say in appSettings).
Of course, this has drawbacks but in most cases works well for a simple list. You can then use String.Split() to convert it back to an array/list.
Otherwise you are back to ConfigurationSection elements which, I agree, are very verbose and clumsy to work with. But I don’t know of any other way, I’m afraid (but am happy to be proved wrong!).