c# - How do I pass a List<int> via FormUrlEncodedContent -


on requester side code looks following

var mylist = new list<int> {1,2,3};  var content =      new formurlencodedcontent     (         new keyvaluepair<string, string>[]         {         keyvaluepair.create("mylist", mylist.tostring())         }     );  //make post request here 

on receiver end want controller method be

[httppost] public void mymethod(list<int> mylist) {     \\ doing stuff here } 

you can try do:

var mylist = new list<int> { 1, 2, 3 };  var mypostdata = new keyvaluepair<string, string>[] {     new keyvaluepair<string, string>("mylist", string.join(",", mylist)) };  var content = new formurlencodedcontent(mypostdata); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -