I’ve seen multiple examples and answers on StackOverflow explaining that this would be the recommended way to create a QueryString to manipulate.
NameValueCollection test = HttpUtility.ParseQueryString(String.Empty);
test.Add("hello", "world");
Console.WriteLine(test.ToString());
But all it returns is
System.Collections.Specialized.NameValueCollection
What’s going on? Simple .NET4 console application to test with (tried earlier Frameworks as well). If I don’t feed it an empty string it starts working, but it seems odd that there are so many posts recommending this as a solution. Wrapped it in a try/catch statement as well just to see if anything strange was going on, no Exceptions are thrown. Am I really supposed to just give it a random string “a=b”, then remove it from the NameValueCollection afterwards in order to get a usable HttpValueCollection?
My ultimate goal was using this with an UriBuilder, grabbing the Query property from it and feeding it to ParseQueryString. However sometimes there might be no query string, UriBuilder.Query will return an empty string…thus this issue came up.
EDIT: In case anyone was confused, what I am intending for it to print out is the query string equivalent of the collection. So if I were to add another value to the collection
test.Add("other", "value");
The result of the ToString() method should be
"hello=world&other=value"
EDIT HI DAVE
My claim? Why it doesn’t work…

Apparently this was an age-old bug in Mono (something I forgot to mention in my question!!).
I was using Mono 2.10.5 with MonoDevelop 2.6.
Seems to be no issues with Microsoft’s System.Web.
Just got it fixed now.