Azavea.Open.Common.Config.GetParameterAsBool C# (CSharp) Method

GetParameterAsBool() public method

Similar to GetParameter, but converts the type for you (if possible, throws if not).
public GetParameterAsBool ( string component, string parameter ) : bool
component string The component or section of the config file, used to /// locate the parameter.
parameter string The name of the config parameter.
return bool
        public bool GetParameterAsBool(string component, string parameter)
        {
            bool retVal;
            if (!bool.TryParse(GetParameter(component, parameter), out retVal))
            {
                throw new LoggingException("Component " + component + ", parameter " +
                    parameter + ", value was unable to be converted to a boolean.");
            }
            return retVal;
        }

Same methods

Config::GetParameterAsBool ( string component, string parameter, bool defaultValue ) : bool
Config::GetParameterAsBool ( string component, string parameter, bool defaultValue ) : bool?