+2009-04-13 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * HttpUtility.cs: the collection returned from ParseQueryString knows
+ how to convert the key/value pairs to a string.
+
2009-04-10 Gonzalo Paniagua Javier <gonzalo@novell.com>
* HttpResponseStream.cs: use the unsafe version when copying buffers.
#endif
#if NET_2_0
+ class HttpQSCollection : NameValueCollection {
+ public override string ToString ()
+ {
+ int count = Count;
+ if (count == 0)
+ return "";
+ StringBuilder sb = new StringBuilder ();
+ string [] keys = AllKeys;
+ for (int i = 0; i < count; i++) {
+ sb.AppendFormat ("{0}={1}&", keys [i], this [keys [i]]);
+ }
+ if (sb.Length > 0)
+ sb.Length--;
+ return sb.ToString ();
+ }
+ }
+
public static NameValueCollection ParseQueryString (string query)
{
return ParseQueryString (query, Encoding.UTF8);
if (query[0] == '?')
query = query.Substring (1);
- NameValueCollection result = new NameValueCollection ();
+ NameValueCollection result = new HttpQSCollection ();
ParseQueryString (query, encoding, result);
return result;
}