Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Duplicate keys in appSettings in App.Config

$
0
0

If I have the following xml in my App.Config

  <appSettings>
    <add key="Key" value="Value1" />
    <add key="Key" value="Value2" />
  </appSettings>

then calling ConfigurationManager.AppSettings.GetValues("Key") returns an array of strings with only one entry -- the last entry in in the appSettings ("Value2").

There was a useful article written on how to get this to work on CodeProject (http://www.codeproject.com/dotnet/namevaluemultiple.asp), but that doesn't seem to work with .net 2.0 (I get a run-time exception that the appsettings section can't be modified).

Does anyone know of a sample somewhere on how to get this to work in .net 2.0?


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>