Delen via


HttpContentHeaderCollection.ContentRange Property

Definition

Gets or sets the HttpContentRangeHeaderValue object that represent the value of an HTTP Content-Range header on the HTTP content.

public:
 property HttpContentRangeHeaderValue ^ ContentRange { HttpContentRangeHeaderValue ^ get(); void set(HttpContentRangeHeaderValue ^ value); };
HttpContentRangeHeaderValue ContentRange();

void ContentRange(HttpContentRangeHeaderValue value);
public HttpContentRangeHeaderValue ContentRange { get; set; }
var httpContentRangeHeaderValue = httpContentHeaderCollection.contentRange;
httpContentHeaderCollection.contentRange = httpContentRangeHeaderValue;
Public Property ContentRange As HttpContentRangeHeaderValue

Property Value

The object that represent the value of the HTTP Content-Range header 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-Range header value on HTTP content using the ContentRange property on the HttpContentHeaderCollection object.

// Content-Range header
// HttpContentRangeHeaderValue (Unit=string, FirstBytePosition, LastBytePosition, Length) all nullable ulong
//
void DemoContentRange(IHttpContent content) {
    var h = content.Headers;
    h.ContentRange = new HttpContentRangeHeaderValue (10, 20, 333);

    var header = h.ContentRange;
    uiLog.Text += "\nCONTENT RANGE HEADER\n";

    uiLog.Text += string.Format("ContentRange: Unit: {0} FirstBytePosition: {1} LastBytePosition: {2} Length: {3} ToString: {4}\n\n", header.Unit, header.FirstBytePosition, header.LastBytePosition, header.Length, header.ToString());
}

Applies to

See also