Wrapping System.Configuration.ConfigurationManager.AppSettings[KeyName] call
if you currently using
System.Configuration.ConfigurationManager.AppSettings[KeyName];
to get the stored asp.net application configurations ,you should check the return value against null value because this method will return null incase this key doesn't exists and you will get a null reference exception if you trying to access this value ... so it's better to wrap this call by a small utility function to throw a meaningfully exception instead of null to prevent the 'null reference exception' which will be more helpful in the deployment scenarios.
here is a small sample :
1: public static string GetKey(string keyName)
2: {
3: if (System.Configuration.ConfigurationManager.AppSettings[keyName] != null)
4: return System.Configuration.ConfigurationManager.AppSettings[keyName].ToString();
5: else
6: throw new ArgumentException("a key with the name " + keyName + " doesn't exists in the current configurations", keyName);
7: }