c# - Add Duplicates keys to NameValueCollection -


i have read namevaluecollection allows duplicate keys added, not seem case when try use it.

my code

using (var wb = new webclient()) {      var data = new namevaluecollection();      var sourcedata = (list<dictionary<string, object>>)dic["mapdata"];      var countsource = sourcedata.count;       foreach (var item in (list<dictionary<string, object>>)dic["mapdata"])      {           data.add("pp", item["latitude"].tostring() + "," + item["longitude"].tostring());      }       var datacount = data.count;      var response = wb.uploadvalues(@"http://dev.virtualearth.net/rest/v1/imagery/map/road/?maparea=" + swlat.tostring() + "," + swlong + "," + nelat + "," + nelong + "&mapsize=800,600&key=" + key, "post", data);       return this.largejson(new { imagedata = createbase64image(response) }); } 

what observing

my sourcedata contains 36 items

watches

i iterating through sourcedata , adding items namevaluecollection data , add items same key "pp"

i expecting have 36 items in data namevaluecollection, getting 1 , of values appended same key.

what missing ?

this expected behaviour - see the documentation:

if specified key exists in target namevaluecollection instance, specified value added existing comma-separated list of values in form "value1,value2,value3". values associated same key in target namevaluecollection instance.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -