Skip to main content
HttpResponseHeaderCollection.TransferEncoding | transferEncoding property

Gets the HttpTransferCodingHeaderValueCollection of HttpTransferCodingHeaderValue objects that represent the value of a Transfer-Encoding HTTP header on an HTTP response.

Syntax


var transferEncoding = httpResponseHeaderCollection.transferEncoding;

public HttpTransferCodingHeaderValueCollection TransferEncoding { get; }

Public ReadOnly Property TransferEncoding As HttpTransferCodingHeaderValueCollection

public:
property HttpTransferCodingHeaderValueCollection^ TransferEncoding { 
   HttpTransferCodingHeaderValueCollection^ get();
}

Property value

Type: HttpTransferCodingHeaderValueCollection

The collection of HttpTransferCodingHeaderValue objects that represent the value of a Transfer-Encoding HTTP header on an HTTP response. An empty collection means that the header is absent.

Remarks

The following sample code shows a method to get and set the Transfer-Encoding header on an HttpResponseMessage object using the TransferEncoding property on the HttpResponseHeaderCollection object.


    // HttpTransferCodingHeaderValueCollection
    // HttpTransferCodingHeaderValue hasValue (string) and Parameters (IList<HttpNameValueHeaderValue>)
    // IList<HttpNameValueHeaderValue>
    // HttpNameValueHeaderValue
    //
    // This is the same type as on the Request TransferEncoding  value
    void DemoTransferEncoding(HttpResponseMessage response) {
        var h = response.Headers;
        h.TransferEncoding.TryParseAdd("Basic");
        h.TransferEncoding.Add(new HttpTransferCodingHeaderValue("gzip"));

        var header = h.TransferEncoding;
        uiLog.Text += "\nTRANSFER ENCODING HEADER\n";
        foreach (var item in header) {
            // Parameters is an IList<HttpNameValueHeaderValue> of Name/Value strings
            var parameterString = "";
            foreach (var parameter in item.Parameters) {
                parameterString += string.Format("[{0}={1}] ", parameter.Name, parameter.Value);
            }
            if (parameterString == "") {
                parameterString = "(no parameters)";
            }
            uiLog.Text += string.Format("Value: {0} Parameters: {1} ToString(): {2}\n", item.Value, parameterString, item.ToString());
        }
        uiLog.Text += String.Format("TransferEncoding: {0}\n", header.ToString());
    }

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.winmd

See also

HttpResponseHeaderCollection
HttpResponseMessage
HttpResponseMessage.Headers
HttpTransferCodingHeaderValue
HttpTransferCodingHeaderValueCollection