Beispiel #1
0
 /// <summary>采用异步操作将 HTTP 内容序列化到内存流。</summary>
 /// <returns>表示异步操作的任务对象。</returns>
 protected virtual Task <Stream> CreateContentReadStreamAsync()
 {
     return(HttpContent.WaitAndReturnAsync <HttpContent, Stream>(this.LoadIntoBufferAsync(), this, (Func <HttpContent, Stream>)(s => (Stream)s._bufferedContent)));
 }
Beispiel #2
0
 /// <summary>将 HTTP 内容序列化到字符串,此为异步操作。</summary>
 /// <returns>表示异步操作的任务对象。</returns>
 public Task <string> ReadAsStringAsync()
 {
     this.CheckDisposed();
     return(HttpContent.WaitAndReturnAsync <HttpContent, string>(this.LoadIntoBufferAsync(), this, (Func <HttpContent, string>)(s => s.ReadBufferedContentAsString())));
 }
Beispiel #3
0
 /// <summary>将 HTTP 内容序列化到字节数组,此为异步操作。</summary>
 /// <returns>表示异步操作的任务对象。</returns>
 public Task <byte[]> ReadAsByteArrayAsync()
 {
     this.CheckDisposed();
     return(HttpContent.WaitAndReturnAsync <HttpContent, byte[]>(this.LoadIntoBufferAsync(), this, (Func <HttpContent, byte[]>)(s => s.ReadBufferedContentAsByteArray())));
 }