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

GetKeyAsDateTime() 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 GetKeyAsDateTime ( String keyName, System.DateTime defaultValue ) : System.DateTime
keyName String Key name for which a value should be returned.
defaultValue System.DateTime Default value to use if the key is not found.
return System.DateTime
        public static DateTime GetKeyAsDateTime(String keyName, DateTime defaultValue)
        {
            DateTime? value = null;

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

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

            return (DateTime)value;
        }

Same methods

H3Config::GetKeyAsDateTime ( String keyName, System.DateTime defaultValue, String sectionName ) : System.DateTime
H3Config::GetKeyAsDateTime ( String keyName, String defaultValue ) : System.DateTime
H3Config::GetKeyAsDateTime ( String keyName, String defaultValue, String sectionName ) : System.DateTime
H3Config::GetKeyAsDateTime ( String keyName ) : DateTime?