public EndGetRequestStream ( IAsyncResult asyncResult ) : Stream | ||
asyncResult | IAsyncResult | |
return | Stream |
public override Stream EndGetRequestStream(IAsyncResult asyncResult)
{
CheckAbort();
if (asyncResult == null || !(asyncResult is Task<Stream>))
{
throw new ArgumentException(SR.net_io_invalidasyncresult, nameof(asyncResult));
}
if (Interlocked.Exchange(ref _endGetRequestStreamCalled, 1) != 0)
{
throw new InvalidOperationException(SR.Format(SR.net_io_invalidendcall, "EndGetRequestStream"));
}
Stream stream;
try
{
stream = ((Task<Stream>)asyncResult).GetAwaiter().GetResult();
}
catch (Exception ex)
{
throw WebException.CreateCompatibleException(ex);
}
return stream;
}
HttpWebRequest::EndGetRequestStream ( IAsyncResult asyncResult, TransportContext &context ) : Stream | |
HttpWebRequest::EndGetRequestStream ( System asyncResult ) : System.IO.Stream | |
HttpWebRequest::EndGetRequestStream ( System asyncResult, System &context ) : System.IO.Stream |
private Stream GetRequestStreamAsynch(HttpWebRequest request) { return AsynchHelper.WaitForAsynchResponse( c => request.BeginGetRequestStream(c, null), (r, s) => request.EndGetRequestStream(r) ); }