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

Solution 1:

No, it returns null.

Solution 2:

From the MSDN documentation for NameValueCollection.Item Property (String):

Caution

This property returns null in the following cases: 1) if the specified key is not found; and 2) if the specified key is found and its associated value is null. This property does not distinguish between the two cases.

Solution 3:

No, it returns null.

AppSettings is a NameValueCollection - as per the caution on the NameValueCollection.Get page:

This method returns a null reference (Nothing in Visual Basic) in the following cases: 1) if the specified key is not found; and 2) if the specified key is found and its associated value is a null reference (Nothing in Visual Basic). This method does not distinguish between the two cases.

Solution 4:

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)