System.Net.HttpWebRequest.GetRequestStreamTask C# (CSharp) Метод

GetRequestStreamTask() приватный Метод

private GetRequestStreamTask ( ) : Task
Результат Task
        private Task<Stream> GetRequestStreamTask()
        {
            CheckAbort();

            if (RequestSubmitted)
            {
                throw new InvalidOperationException(SR.net_reqsubmitted);
            }

            // Match Desktop behavior: prevent someone from getting a request stream
            // if the protocol verb/method doesn't support it. Note that this is not
            // entirely compliant RFC2616 for the aforementioned compatibility reasons.
            if (string.Equals(HttpMethod.Get.Method, _originVerb, StringComparison.OrdinalIgnoreCase) ||
                string.Equals(HttpMethod.Head.Method, _originVerb, StringComparison.OrdinalIgnoreCase) ||
                string.Equals("CONNECT", _originVerb, StringComparison.OrdinalIgnoreCase))
            {
                throw new ProtocolViolationException(SR.net_nouploadonget);
            }

            _requestStream = new RequestStream();

            return Task.FromResult((Stream)_requestStream);
        }