Share via


HttpContentHeaderCollection.ContentLength Property

Definition

Gets or sets the value of the HTTP Content-Length header on the HTTP content.

public:
 property IReference<unsigned long long> ^ ContentLength { IReference<unsigned long long> ^ get(); void set(IReference<unsigned long long> ^ value); };
IReference<uint64_t> ContentLength();

void ContentLength(IReference<uint64_t> value);
public System.Nullable<ulong> ContentLength { get; set; }
var iReference = httpContentHeaderCollection.contentLength;
httpContentHeaderCollection.contentLength = iReference;
Public Property ContentLength As Nullable(Of ULong)

Property Value

IReference<UInt64>

Nullable<UInt64>

Windows.Foundation.IReference<unsigned long long>

IReference<uint64_t>

The value of the HTTP Content-Length header value on the HTTP content. A null value means that the header is absent.

Remarks

The following sample code shows a method to get or set the Content-Length header on HTTP content using the ContentLength property on the HttpContentHeaderCollection object.

// Content-Length header
// nullable ulong
void DemoContentLength(IHttpContent content) {
    var h = content.Headers;

    h.ContentLength = 313;

    var header = h.ContentLength;
    uiLog.Text += "\nCONTENT LENGTH HEADER\n";

    uiLog.Text += string.Format("ContentLength: ToString: {0}\n\n", header.ToString());
}

Applies to