Argentini.Halide.H3Config.GetKeyAsInt32 C# (CSharp) Method

GetKeyAsInt32() public static method

Retrieve the value of an application setting from the Web.config file. Returns the default value if the key is not found.
public static GetKeyAsInt32 ( String keyName, Int32 defaultValue ) : Int32
keyName String Key name for which a value should be returned.
defaultValue System.Int32 Default value to use if the key is not found.
return System.Int32
        public static Int32 GetKeyAsInt32(String keyName, Int32 defaultValue)
        {
            Int32? value = null;

            if (ConfigurationManager.AppSettings[keyName] != null)
            {
                if (H3Identify.IsPureNumeric(ConfigurationManager.AppSettings[keyName].ToString()))
                {
                    value = Convert.ToInt32(ConfigurationManager.AppSettings[keyName]);
                }
            }

            if (value == null)
            {
                value = defaultValue;
            }

            return (Int32)value;
        }

Same methods

H3Config::GetKeyAsInt32 ( String keyName, Int32 defaultValue, String sectionName ) : Int32
H3Config::GetKeyAsInt32 ( String keyName, String defaultValue ) : Int32
H3Config::GetKeyAsInt32 ( String keyName, String defaultValue, String sectionName ) : Int32
H3Config::GetKeyAsInt32 ( String keyName ) : Int32?