/// <summary>
            /// Get a string value from a dictionary, and convert it to integer.  Throw an
            /// exception if it's not a valid positive integer string.
            /// However, don't complain about null, which simply means the value is not
            /// in the dictionary.
            /// The value is returned through a REF param (unchanged if null)
            /// </summary>
            /// <returns>True if attrib exists, false otherwise</returns>
            internal static bool GetAndRemoveNonNegativeIntegerAttribute(IDictionary directives, string key, ref int val)
            {
                string s = ServiceParserUtilities.GetAndRemove(directives, key);

                if (s.Length == 0)
                {
                    return(false);
                }

                val = GetNonNegativeIntegerAttribute(key, s);
                return(true);
            }
            /// <summary>
            /// Get a value from a dictionary, and remove it from the dictionary if
            /// it exists.  Throw an exception if the value is a whitespace string.
            /// However, don't complain about null, which simply means the value is not
            /// in the dictionary.
            /// </summary>
            internal static string GetAndRemoveNonEmptyAttribute(IDictionary directives, string key, bool required)
            {
                string val = ServiceParserUtilities.GetAndRemove(directives, key);

                if (val.Length == 0)
                {
                    if (required)
                    {
                        throw FxTrace.Exception.AsError(new HttpException(SR.Hosting_BuildProviderAttributeMissing(key)));
                    }
                    return(null);
                }

                return(val);
            }
            /// <summary>
            /// Get a string value from a dictionary, and convert it to bool.  Throw an
            /// exception if it's not a valid bool string.
            /// However, don't complain about null, which simply means the value is not
            /// in the dictionary.
            /// The value is returned through a REF param (unchanged if null)
            /// </summary>
            /// <returns>True if attrib exists, false otherwise</returns>
            internal static bool GetAndRemoveBooleanAttribute(IDictionary directives, string key, ref bool val)
            {
                string s = ServiceParserUtilities.GetAndRemove(directives, key);

                if (s.Length == 0)
                {
                    return(false);
                }

                try
                {
                    val = bool.Parse(s);
                }
                catch (FormatException)
                {
                    throw FxTrace.Exception.AsError(new HttpException(SR.Hosting_BuildProviderInvalidValueForBooleanAttribute(s, key)));
                }

                return(true);
            }