Torna al Thread

namespace RestSharpEx {     public static class RestClientExtensions     {       public static Task<IRestResponse> ExecuteTaskAsync(this RestClient @this, RestRequest request)       {         if (@this == null)             throw new NullReferenceException();                var tcs = new TaskCompletionSource<IRestResponse>();                @this.ExecuteAsync(request, (response) =>         {             if (response.ErrorException != null)                 tcs.TrySetException(response.ErrorException);             else                 tcs.TrySetResult(response);         });                return tcs.Task;       }     } }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5