On the requester side my code looks like 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 the receiver end I want my controller method to be
[HttpPost]
public void MyMethod(List<int> myList)
{
\\ Doing stuff here
}
You can try to 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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With