Beispiel #1
0
 public Task <byte[]> GetByteArrayAsync(Uri requestUri)
 {
     return(GetAsync(requestUri, HttpCompletionOption.ResponseContentRead).ContinueWith(t =>
     {
         HttpResponseMessage r = t.GetAwaiter().GetResult();
         r.EnsureSuccessStatusCode();
         HttpContent c = r.Content;
         return c != null ? c.ReadBufferedContentAsByteArray() : Array.Empty <byte>();
     }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default));
 }