Read .NET Configuration Files Using NameValueSectionHandler And AppSettingsSection Types In C#
Hello all, I've read from a tutorial NameValueCollection and .NET Configuration Files which targets .NET 1.0/1.1 on how to read config files using type NameValueSectionHandler. I intend to explore more on applying this concept to recent versions of .NET frameworks. Upon doing some diggings, I came up with two options. First is using NameValueSectionHandler type and the other one is AppSettingsSections. To begin with, I have this App.config file with XML elements scriptsfiles and docfiles all registered in configSections. <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name= "scriptfiles" type= "System.Configuration.NameValueSectionHandler" /> <section name= "docfiles" type= "System.Configuration.AppSettingsSection" /> </configSections> <scriptfiles> <add key= "C:\batchfiles\2017" value= "*.bat" />