Quantcast
Channel: Will ConfigurationManager.AppSettings["blah"] throw an exception if "blah" doesn't exist? - Stack Overflow
Viewing all articles
Browse latest Browse all 8

Answer by Andrew for Will ConfigurationManager.AppSettings["blah"] throw an exception if "blah" doesn't exist?

$
0
0

No, it returns null.

ConfigurationManager.AppSettings is a NameValueCollection - from the MSDN documentation:

The Get method does not distinguish between null which is returned because the specified key is not found and null which is returned because the value associated with the key is null.

(my emphasis)


Viewing all articles
Browse latest Browse all 8

Trending Articles



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