public static bool TryParse(string value, QueryStringBuilder builder)
        {
            if (builder == null)
                builder = new QueryStringBuilder();

            if (value == null)
                return false;

            if (value == string.Empty)
                return true;

            string query = null;
            if (value.StartsWith("?") || value.StartsWith("&"))
                query = value.Substring(1);
            else
                query = value.Contains("?") ? value.Substring(value.IndexOf("?") + 1) : value;

            if (string.IsNullOrEmpty(query))
                return true;

            foreach (string keyValuePair in query.Split('&'))
            {
                if (string.IsNullOrEmpty(keyValuePair)) continue;
                string[] split = keyValuePair.Split('=');
                builder.Add(HttpUtility.UrlDecode(split[0]), split.Length == 2 ? HttpUtility.UrlDecode(split[1]) : "");
            }

            if (!string.IsNullOrEmpty(query) && builder.Count == 0)
                return false;

            return true;
        }
        public Uri AppendTo(Uri uri)
        {
            if (!uri.IsAbsoluteUri)
                return new Uri(AppendTo(uri.ToString()), UriKind.RelativeOrAbsolute);
 
            string query = null;
            if (!string.IsNullOrEmpty(uri.Query))
                query = new QueryStringBuilder(uri.Query).Append(this).ToString();
            else
                query = ToString();

            return new Uri(uri.GetLeftPart(UriPartial.Path) 
                + (string.IsNullOrEmpty(query) ? "" : "?" + query));  
        }
 public string AppendTo(string url)
 {
     
     QueryStringBuilder query = new QueryStringBuilder(url).Append(this);
     
     string path = url;
     if (!string.IsNullOrEmpty(url))
     {
         if (url.Contains("?"))
             path = url.Substring(0, url.IndexOf("?"));
         
         if (!string.IsNullOrEmpty(path))
             return path + (query.Count == 0 ? "" : "?" + query.ToString());
     }
     return query.ToString();
 }
 public QueryStringBuilder Append(QueryStringBuilder builder)
 {
     for (var i = 0; i < builder.Keys.Count; i++)
     {
         string key = builder.Keys[i];
         if (!string.IsNullOrEmpty(key))
         {
             Add(key, builder[key]);
         }
     }
     return builder;
 }