/// <summary>
        /// Parse a query string
        /// </summary>
        /// <param name="queryString">string to parse</param>
        /// <returns>A collection</returns>
        /// <exception cref="ArgumentNullException"><c>queryString</c> is <c>null</c>.</exception>
        public ParameterCollection Parse(string queryString)
        {
            if (queryString == null)
                throw new ArgumentNullException("queryString");
            if (queryString.Length == 0)
                return new ParameterCollection();

            var reader = new StringReader(queryString);
            var col = new ParameterCollection();
            Parse(reader, col);
            return col;
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="HttpHeaderValue" /> class.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <exception cref="System.ArgumentNullException">value</exception>
        public HttpHeaderValue(string value)
        {
            if (value == null) throw new ArgumentNullException("value");

            var pos = value.IndexOf(';');
            if (pos == -1)
            {
                Value = value;
                _parameters = new ParameterCollection();
            }
            else
            {
                Value = value.Substring(0, pos);
                _parameters = ParameterCollection.Parse(value.Substring(pos + 1));
            }
        }
        /// <summary>
        /// Parse string
        /// </summary>
        /// <param name="value">contains "a=b,c=d" etc</param>
        /// <param name="target">Collection to fill with the values</param>
        public static void Parse(string value, ParameterCollection target)
        {
            if (value == null) throw new ArgumentNullException("value");
            if (target == null) throw new ArgumentNullException("target");

            var index = 0;
            var lastCh = char.MinValue;

            var name = "";
            var oldPos = 0;
            bool gotEquals = false;
            while (index < value.Length)
            {
                var ch = value[index];
                switch (ch)
                {
                    case '=':
                        if (gotEquals)
                            break;

                        gotEquals = true;
                        if (lastCh != '\\')
                        {
                            name = value.Substring(oldPos, index - oldPos).Trim(' ');
                            oldPos = index + 1;
                        }
                        break;
                    case ',':
                        gotEquals = false;
                        if (lastCh != '\\')
                        {
                            target.Add(name, value.Substring(oldPos, index - oldPos).Trim(' ', '"'));
                            name = "";
                            oldPos = index + 1;
                        }
                        break;
                }
                lastCh = value[index];
                ++index;
            }

            if (name != "")
            {
                target.Add(name, value.Substring(oldPos).Trim(' ', '"'));
            }
        }
 /// <summary>
 /// Parse string
 /// </summary>
 /// <param name="value">contains "a=b,c=d" etc</param>
 public static ParameterCollection Parse(string value)
 {
     var collection = new ParameterCollection();
     Parse(value, collection);
     return collection;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="httpMethod">Method like <c>POST</c>.</param>
 /// <param name="pathAndQuery">Absolute path and query string (if one exist)</param>
 /// <param name="httpVersion">HTTP version like <c>HTTP/1.1</c></param>
 public HttpRequest(string httpMethod, string pathAndQuery, string httpVersion) : base(httpMethod, pathAndQuery, httpVersion)
 {
     Form = new ParameterCollection();
     Files = new HttpFileCollection();
     Cookies = new HttpCookieCollection<IHttpCookie>();
 }