Represents an asynchronous response.
Наследование: IDisposable
Пример #1
0
 /// <summary>
 /// Create a <see cref="TwitterException"/> instance from the <see cref="AsyncResponse"/>.
 /// </summary>
 /// <returns><see cref="TwitterException"/> instance or null.</returns>
 public static async Task <TwitterException> Create(AsyncResponse response)
 {
     try
     {
         using (var sr = new StreamReader(await response.GetResponseStreamAsync().ConfigureAwait(false)))
             return(Create(
                        await sr.ReadToEndAsync().ConfigureAwait(false),
                        (HttpStatusCode)response.StatusCode,
                        null,
                        InternalUtils.ReadRateLimit(response)
                        ));
     }
     catch
     {
         return(null);
     }
 }
Пример #2
0
 /// <summary>
 /// Create a <see cref="CoreTweet.TwitterException"/> instance from the <see cref="CoreTweet.AsyncResponse"/>.
 /// </summary>
 /// <returns><see cref="CoreTweet.TwitterException"/> instance or null.</returns>
 public static async Task<TwitterException> Create(AsyncResponse response)
 {
     try
     {
         using(var sr = new StreamReader(await response.GetResponseStreamAsync().ConfigureAwait(false)))
             return Create(
                 await sr.ReadToEndAsync().ConfigureAwait(false),
                 (HttpStatusCode)response.StatusCode,
                 null,
                 InternalUtils.ReadRateLimit(response)
             );
     }
     catch
     {
         return null;
     }
 }