Ошибка, которую я получаю, находится в последней строке оператора return.
"Невозможно неявно преобразовать тип 'System.Threading.Tasks.Task' в RestSharp.IRestResponse '. Явное преобразование завершается (вам не хватает актерского состава?) "
public static async Task<IRestResponse<T>> ExecuteAsyncRequest<T>(this RestClient client, IRestRequest request) where T : class, new() //Since we used the T. We need to specify wether T is of type class or new type
{
var taskCompletionSource = new TaskCompletionSource<IRestResponse>();
client.ExecuteAsync<T>(request, restResponse =>
{
//Verbose message of the error
if (restResponse.ErrorException != null)
{
const string message = "Error retrieving response.";
throw new ApplicationException(message, restResponse.ErrorException);
}
//Setting the result of the execution
taskCompletionSource.SetResult(restResponse);
});
//return us the reuslt
return await taskCompletionSource.Task;