AuthBridge.Clients.Util.ConfigurationExtensions.GetBoolSetting C# (CSharp) Method

GetBoolSetting() public static method

public static GetBoolSetting ( this configuration, string key, Func ifNotFound = null ) : bool
configuration this
key string
ifNotFound Func
return bool
        public static bool GetBoolSetting(this NameValueCollection configuration, string key, Func<bool> ifNotFound = null)
        {
            ifNotFound = ifNotFound ?? (() => false);
            var value = configuration.Get(key);
            bool result;
            return string.IsNullOrEmpty(value) ? ifNotFound() : (bool.TryParse(value, out result) ? result : ifNotFound());
        }
ConfigurationExtensions