/// <summary>
        /// Retrieve an app setting short value from config.
        /// </summary>
        /// <param name="key">Key to use when retrieving the value.</param>
        /// <returns>App setting value.</returns>
        /// <exception cref="T:ByteDev.Configuration.AppSettings.AppSettingsKeyNotExistException">Config does not contain AppSetting with <paramref name="key" />.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type short.</exception>
        public short GetShort(string key)
        {
            var value = GetString(key);

            return(ConfigValueConverter.GetShort(key, value));
        }
예제 #2
0
        /// <summary>
        /// Retrieves a short value.
        /// </summary>
        /// <param name="key">Key to retrieve the value.</param>
        /// <param name="sectionName">Section name to retrieve the value from.</param>
        /// <returns>Config value for the <paramref name="key" />.</returns>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Config section does not exist.</exception>
        /// <exception cref="T:ByteDev.Configuration.ConfigSection.ConfigSettingsProviderException">Key does not exist in the section.</exception>
        /// <exception cref="T:ByteDev.Configuration.UnexpectedConfigValueTypeException">Config value is not of type short.</exception>
        public short GetShort(string key, string sectionName)
        {
            var value = GetString(key, sectionName);

            return(ConfigValueConverter.GetShort(key, value));
        }