Clear() public method

Removes all headers from the collection.
public Clear ( ) : void
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Copies some properties from the specified <see cref="HttpListenerResponse"/> to
        /// this response.
        /// </summary>
        /// <param name="templateResponse">
        /// A <see cref="HttpListenerResponse"/> to copy.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="templateResponse"/> is <see langword="null"/>.
        /// </exception>
        public void CopyFrom(HttpListenerResponse templateResponse)
        {
            if (templateResponse == null)
            {
                throw new ArgumentNullException("templateResponse");
            }

            if (templateResponse._headers != null)
            {
                if (_headers != null)
                {
                    _headers.Clear();
                }

                Headers.Add(templateResponse._headers);
            }
            else if (_headers != null)
            {
                _headers = null;
            }

            _contentLength     = templateResponse._contentLength;
            _statusCode        = templateResponse._statusCode;
            _statusDescription = templateResponse._statusDescription;
            _keepAlive         = templateResponse._keepAlive;
            _version           = templateResponse._version;
        }
Ejemplo n.º 2
0
 public void CopyFrom(HttpListenerResponse templateResponse)
 {
     headers.Clear();
     headers.Add(templateResponse.headers);
     content_length     = templateResponse.content_length;
     status_code        = templateResponse.status_code;
     status_description = templateResponse.status_description;
     keep_alive         = templateResponse.keep_alive;
     version            = templateResponse.version;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Copies properties from the specified <see cref="HttpListenerResponse"/>
 /// to this response.
 /// </summary>
 /// <param name="templateResponse">
 /// A <see cref="HttpListenerResponse"/> to copy.
 /// </param>
 public void CopyFrom(HttpListenerResponse templateResponse)
 {
     _headers.Clear();
     _headers.Add(templateResponse._headers);
     _contentLength     = templateResponse._contentLength;
     _statusCode        = templateResponse._statusCode;
     _statusDescription = templateResponse._statusDescription;
     _keepAlive         = templateResponse._keepAlive;
     _version           = templateResponse._version;
 }