I have the following method and getting the following error. I wonder how could I able to overcome on this issue.
The return type of an async method must
The rule is simple: if your "regular" synchronous method would return T
, your async
method must return Task
:
private static async Task GoRequest(string url, Dictionary parameters, HttpMethod method,string body = "")
where T : class
You don't need to change anything else: when your async
code returns a T
, the compiler makes sure that the result is actually a Task
.
Note: Since your async
method has no await
s in it, you might as well change it to a "regular", synchronous, method.