WebRequest.GetRequestStreamAsync 方法

定义

当在子类中被重写时,将用于写入数据的 Stream 作为异步操作返回到 Internet 资源。When overridden in a descendant class, returns a Stream for writing data to the Internet resource as an asynchronous operation.

public:
 virtual System::Threading::Tasks::Task<System::IO::Stream ^> ^ GetRequestStreamAsync();
public virtual System.Threading.Tasks.Task<System.IO.Stream> GetRequestStreamAsync ();
abstract member GetRequestStreamAsync : unit -> System.Threading.Tasks.Task<System.IO.Stream>
override this.GetRequestStreamAsync : unit -> System.Threading.Tasks.Task<System.IO.Stream>
Public Overridable Function GetRequestStreamAsync () As Task(Of Stream)

返回

表示异步操作的任务对象。The task object representing the asynchronous operation.

注解

此操作不会阻止。This operation will not block. 当将数据写入 Internet 资源的 Stream 可用时,将完成返回的 Task<TResult> 对象。The returned Task<TResult> object will complete when the Stream for writing data to the Internet resource is available.

调用 GetRequestStreamAsync后,请确保在调用 GetResponseAsync之前关闭请求流。After you call GetRequestStreamAsync, make sure you close the request stream before you call GetResponseAsync.

适用于