[Mono-dev] Problem with a NameValueCollection

Sebastian Schäfer mono at dungeon.de
Mon Apr 13 07:22:53 EDT 2009


Hi,

i'm using the myspaceid-sdk and want to use it with mono 2.4...

And there is a problem with the handling of a NameValueCollection...

the code looks like:


var query = HttpUtility.ParseQueryString(uri.Query); // creates an empty 
NameValueCollection
query.Add("key","value);
resourceUri += "?" + query;


in dotnet this will create a string like "http://www.website.com?key=value"

in mono the string looks like "http://www.website.com?NameValueCollection"

so i'm using a simple work around for this:

if(query.Count>0)
  for(int i = 0;i<query.Count;i++){
    resourceUri += i==0 ? "?" : "&";
    resourceUri += query.GetKey(i) + "=" + query.Get(i);
  }


but is there any better solution for this problem?

thanks
Sebastian


More information about the Mono-devel-list mailing list