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
Post a Comment