Candor.Configuration.Provider.ProviderHelperExtensions.GetInt64Value C# (CSharp) Method

GetInt64Value() public static method

A helper method to get a Int64 integer value from a configuration setting value.
public static GetInt64Value ( this config, string name, System.Int64 defaultValue ) : System.Int64
config this The available configuation values.
name string The name of the setting to retrieve.
defaultValue System.Int64 The default in case the named /// value does not exist.
return System.Int64
        public static Int64 GetInt64Value( this NameValueCollection config,
			string name, Int64 defaultValue )
        {
            if (config == null)
                return defaultValue;
            string val = config[name];
            if (val == null)
                return defaultValue;
            val = val.Trim();
            if (val.Length == 0)
                return defaultValue;

            try
            {
                return Int64.Parse(val);
            }
            catch (Exception)
            {
                throw new ArgumentOutOfRangeException(name, val,
                    string.Format("'{0}' must be an integer value.", name));
            }
        }