Example #1
0
        /// '-----------------------------------------------------------------------------------------
        /// <summary>
        /// Get specified config app setting's value as an integer number.
        /// </summary>
        /// <param name="appSetting"></param>
        /// <returns></returns>
        /// '-----------------------------------------------------------------------------------------
        public static int GetAppSettingAsInt(string appSetting)
        {
            string setting = AppSettings[appSetting];

            if (setting == null || setting.Trim().Length == 0)
            {
                throw new ConfigurationErrorsException(String.Format(MISSING_APPSETTING_ERR_MSG, appSetting));
            }

            return(IntegerHelper.ConvertToInt(setting));
        }