public static bool? GetBoolean()

in src/DeloitteDigital.Atlas/Extensions/NameValueCollectionExtensions.cs [89:111]


        public static bool? GetBoolean(this NameValueCollection nvc, string key)
        {
            bool value;
            var stringValue = nvc[key];
            if (bool.TryParse(stringValue, out value))
                return value;

            if (string.IsNullOrEmpty(stringValue))
                return null;

            stringValue = stringValue.ToLowerInvariant();
            switch (stringValue)
            {
                case "1":
                case "t":
                    return true;
                case "0":
                case "f":
                    return false;
                default:
                    return null;
            }
        }