I have this code as in below in my application, at first it could not compile, it showed error message as
"The type 'Task' exists in both 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' "
so I removed the "System.Threading"
I installed via Nuget, then the new error message is as:
CS0012: The type 'System.Threading.Tasks.Task`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
pointing the error at the following line in the code below
Task<HttpResponseMessage> t = client.PostAsync("https://Mypay.com/api/", content);
This is the code as I used it:
var client = new HttpClient();
var values = new List<KeyValuePair<string, string>>();
values.Add(new KeyValuePair<string, string>("task", task));
values.Add(new KeyValuePair<string, string>("merchant", merchant_id));
values.Add(new KeyValuePair<string, string>("ref", id));
// include other fields
var content = new FormUrlEncodedContent(values);
Task<HttpResponseMessage> t = client.PostAsync("https://Mypay.com/api/", content);
t.Wait();
var response = t.Result;
So how do I reference the assembly, or correct the error?